Never been to DZone Snippets before?

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

About this user

Pete http://metanation.net

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

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.

   1  
   2  strftime('%Y-%m-%dT%H:%M:%S%z');


If you're in Ruby, you can access this the quick way with:

   1  
   2  $ irb
   3  >> require 'time'
   4  => true
   5  >> Time.now.iso8601
   6  => "2008-07-09T16:13:30+12:00"


Rails example:

   1  
   2  <abbr class="dtstart" title="<%= event.start_date.iso8601"><%= event.start_date.to_s(:long) %></abbr>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS