I am building a Sinatra site which has mixed UTC/PST data sources, but will be viewed in PST. So I need a way to easily convert Time objects from UTC to PST. Without Rails, I d
I recently did the same thing on an iron.io worker which default time is UTC
# For generality/testing, only require what you need.
require 'active_support/all'
# Set the Timezone
Time.zone = "Asia/Hong_Kong"
t = Time.zone.now
#=> 2015-01-20 16:44:58 +0800
For info on the supported Timezones take a look at ActiveSupport http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html