v2.0.0 - Show latest stable - 2 notes - Class: ActiveSupport::CoreExtensions::DateTime::Conversions
to_formatted_s(format = :default) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
April 21, 2009
3 thanks

Format not coming out properly?

Date, Time and DateTime may have different formats defined.

If you do:


You will get (or something):

April 16th, 2009 22:03 

But if you do:


You will get:

April 16th, 2009

So, be sure you know which one you are working with.

January 21, 2010
3 thanks

W3CDTF Format

Here is the formatted string for the W3CDTF datetime format (http://www.w3.org/TR/NOTE-datetime). It has a semicolon in the timezone part, therefore you cannot use ā€˜%zā€™:

Time::DATE_FORMATS[:w3cdtf] = lambda { |time| time.strftime("%Y-%m-%dT%H:%M:%S#{time.formatted_offset}") }