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
If you don't want to load a ton of libraries, and if you don't mind doing it the poor man's way, and you know your offset is -8 for example, you can subtract 8*3600 seconds to get the new time. For example,
offset=-8
t = Time.now + offset * 3600
You'll need to adjust for day light savings time yourself though, also this doesn't change the time zone so %z won't be right.