karlingen
karlingen

Reputation: 14625

How can I use Time.at with a specific timezone in Ruby?

I have a value of 36000 which is stored in a DB column and is the number of seconds since midnight in UTC that in time equals to 11:00.

I want Time.at(36000).utc to give me the the value: 1970-01-01 11:00:00 UTC but instead I'm getting 1970-01-01 10:00:00 UTC

Any ideas how I could achieve this?

Upvotes: 1

Views: 409

Answers (2)

Cyzanfar
Cyzanfar

Reputation: 7136

Try this little hack Time.at(36000).utc + 3600 where 3600 is the number of seconds in an hour

Upvotes: 0

MaximusDominus
MaximusDominus

Reputation: 2107

36000 seconds is 10 hours. Try 39600

Upvotes: 1

Related Questions