In my application i use such table(table as follows) in which the
Date_time field by default takes (2001-07-21 11:31:00 UTC)such time
format but i want only date, then how i remove the created_time &
updated_time.
Also how to change the format of date i want dd/mm/yyyy
···
-------------------------------------------------------------------------
creation_id Modification_id Delete Date_time
X Data N 2001-07-21 11:31:00 UTC
-------------------------------------------------------------------------
--
Posted via http://www.ruby-forum.com/.
In my application i use such table(table as follows) in which the
Date_time field by default takes (2001-07-21 11:31:00 UTC)such time
format but i want only date, then how i remove the created_time &
updated_time.
Then you should use class Date.
require 'date'
puts Date.today
Also how to change the format of date i want dd/mm/yyyy
You should make the distinction between internal and external representation: internally you use a data type that properly abstracts "dates". For output you transform this into a suitable format.
irb(main):008:0> Date.today.strftime "%d/%m/%Y"
=> "09/04/2009"
If you internally need also time then you can use class DateTime and apply the same formatting:
irb(main):010:0> DateTime.now.strftime "%d/%m/%Y"
=> "09/04/2009"
HTH
Kind regards
robert
···
On 09.04.2009 15:39, Sushrut Sathe wrote: