Created
August 17, 2011 00:19
-
-
Save sawamur/1150505 to your computer and use it in GitHub Desktop.
To convert a time in PDT to JST
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
require 'active_support/core_ext' | |
# need "core_ext" to load timezone modules | |
Time.zone = "Pacific Time (US & Canada)" | |
# There's no timezone just for 'PDT'. | |
t = Time.zone.parse("2011-08-22 14:00:00") | |
p t | |
# => Mon, 22 Aug 2011 14:00:00 PDT -07:00 | |
p t.in_time_zone("Tokyo") | |
# => Tue, 23 Aug 2011 06:00:00 JST +09:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment