DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
ISO 8601 Date Format For Microformats
Strftime to get the ISO 8601 (see RFC 3339) full date format for an hEvent Microformat. Doubtless usable in other situations.
strftime('%Y-%m-%dT%H:%M:%S%z');
If you're in Ruby, you can access this the quick way with:
$ irb >> require 'time' => true >> Time.now.iso8601 => "2008-07-09T16:13:30+12:00"
Rails example:
<abbr class="dtstart" title="<%= event.start_date.iso8601"><%= event.start_date.to_s(:long) %></abbr>






Comments
Snippets Manager replied on Mon, 2008/12/01 - 3:23pm
Snippets Manager replied on Sun, 2008/01/13 - 3:55am
Snippets Manager replied on Thu, 2008/06/12 - 7:31pm