Skip to content

Instantly share code, notes, and snippets.

@swdyh
Created May 14, 2013 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swdyh/5574853 to your computer and use it in GitHub Desktop.
Save swdyh/5574853 to your computer and use it in GitHub Desktop.
require 'time'
# http://doc.ruby-lang.org/ja/2.0.0/method/Time/i/iso8601.html
t = Time.now
p t # 2013-05-14 18:42:37 +0900
p t.iso8601 # "2013-05-14T18:42:37+09:00"
p t.iso8601(3) # "2013-05-14T18:42:37.192+09:00"
p t.iso8601(6) # "2013-05-14T18:42:37.192681+09:00"
p t.iso8601(10) # "2013-05-14T18:42:37.1926810000+09:00"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment