Skip to content

Instantly share code, notes, and snippets.

@sawamur
Created August 17, 2011 00:19
Show Gist options
  • Save sawamur/1150505 to your computer and use it in GitHub Desktop.
Save sawamur/1150505 to your computer and use it in GitHub Desktop.
To convert a time in PDT to JST
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