Created
February 10, 2010 21:26
-
-
Save awesome/300862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://snippets.dzone.com/posts/show/5364 | |
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> | |
aslak.hellesoy posts on Jun 12, 2008 at 19:58 | |
Ruby has a built-in method for this: Time#iso8601 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment