<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>OnRails.org: What are all the Rails Date Formats?</title>
    <link>http://www.onrails.org/articles/2008/08/20/what-are-all-the-rails-date-formats</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Ruby On Rails and related matters.</description>
    <item>
      <title>What are all the Rails Date Formats?</title>
      <description>&lt;p&gt;Ever forget what all the Rails defined &lt;code&gt;Date/DateTime/Time#strftime&lt;/code&gt; formats are?  Or forget what ones you added to the project yourself?&lt;/p&gt;


	&lt;p&gt;Ala &lt;code&gt;rake routes&lt;/code&gt; comes &lt;code&gt;rake date_formats&lt;/code&gt;:&lt;/p&gt;


&lt;script src="http://gist.github.com/1352.js"&gt;&lt;/script&gt;

Sample output from a Rails 2.1 app:
&lt;pre&gt;
Date
====
            db:'%Y-%m-%d'   2008-08-20
  long_ordinal:'&amp;#38;proc'      August 20th, 2008
          long:'%B %e, %Y'  August 20, 2008
        rfc822:'%e %b %Y'   20 Aug 2008
        number:'%Y%m%d'     20080820
         short:'%e %b'      20 Aug

DateTime
========
            db:'%Y-%m-%d'   2008-08-20 16:56:21
  long_ordinal:'&amp;#38;proc'      August 20th, 2008 16:56
          long:'%B %e, %Y'  August 20, 2008 16:56
        rfc822:'%e %b %Y'   Wed, 20 Aug 2008 16:56:21 -0600
        number:'%Y%m%d'     20080820165621
         short:'%e %b'      20 Aug 16:56

Time
====
            db:'%Y-%m-%d %H:%M:%S'         2008-08-20 16:56:21
  long_ordinal:'&amp;#38;proc'                     August 20th, 2008 16:56
          long:'%B %d, %Y %H:%M'           August 20, 2008 16:56
        rfc822:'%a, %d %b %Y %H:%M:%S %z'  Wed, 20 Aug 2008 16:56:21 -0600
         short:'%d %b %H:%M'               20 Aug 16:56
        number:'%Y%m%d%H%M%S'              20080820165621
          time:'%H:%M'                     16:56
&lt;/pre&gt;</description>
      <pubDate>Wed, 20 Aug 2008 22:54:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:2c07559a-8ec6-4f69-8d07-d657c497ffcd</guid>
      <author>Lee Marlow</author>
      <link>http://www.onrails.org/articles/2008/08/20/what-are-all-the-rails-date-formats</link>
      <category>Rails Tips</category>
    </item>
    <item>
      <title>"What are all the Rails Date Formats?" by David Andrew Thompson</title>
      <description>&lt;p&gt;I added it to my rails gem so that new applications I generate will have the new rake task. To add this functionality just add the code to the routes.rake file under the rails gem folder, so:&lt;/p&gt;


	&lt;p&gt;~/gems/rails-2.1.0/lib/tasks/routes.rake&lt;/p&gt;</description>
      <pubDate>Thu, 21 Aug 2008 18:03:01 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:841e506d-0737-4f31-955c-920ee5cd3378</guid>
      <link>http://www.onrails.org/articles/2008/08/20/what-are-all-the-rails-date-formats#comment-3942</link>
    </item>
    <item>
      <title>"What are all the Rails Date Formats?" by Jeremy Pinnix</title>
      <description>&lt;p&gt;Excellent job Lee. I just added this output as a cheat sheet:&lt;/p&gt;


	&lt;p&gt;$ cheat rails_date_formats&lt;/p&gt;</description>
      <pubDate>Thu, 21 Aug 2008 01:35:50 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:519e9847-106b-4139-9399-f1cb05ac076c</guid>
      <link>http://www.onrails.org/articles/2008/08/20/what-are-all-the-rails-date-formats#comment-3941</link>
    </item>
    <item>
      <title>"What are all the Rails Date Formats?" by Luke Francl</title>
      <description>&lt;p&gt;Cool! I just added it to my application. It&amp;#8217;s nice to see them all in one place.&lt;/p&gt;</description>
      <pubDate>Thu, 21 Aug 2008 00:12:31 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ebbde32c-e254-4acd-9eb1-0414b02c1763</guid>
      <link>http://www.onrails.org/articles/2008/08/20/what-are-all-the-rails-date-formats#comment-3940</link>
    </item>
  </channel>
</rss>
