On 09.04.2009 15:39, Sushrut S. wrote:
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 &
Then you should use class Date.
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”
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”