Links
Twitter
Flickr
« MacBook blues | Main | Getting paid »
Thursday
May152008

Rails date formats

Handy:

In console:

Date::DATE_FORMATS.each_pair {|key, value|puts "#{key} => #{Date.today.to_s(key)}"}

Prints a list of each available format with an example.


short => 15 May
long => May 15, 2008
long_ordinal => May 15th, 2008
db => 2008-05-15
rfc822 => 15 May 2008
number => 20080515


Would be better as a rake task.


Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>