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
Get the current time in utc, then add the offset:
Time.now.utc + Time.zone_offset('PDT')
#=> 2015-12-01 18:10:07 UTC
The problem here is that PDT
is fixed to -8
, PST
is fixed to -7
and Pacific Zone (one that adjusts between the two based on time of year and daylight savings) does not exist, for that you likely need ActiveSupport.