Change Time zone in pure ruby (not rails)

前端 未结 5 1554
抹茶落季
抹茶落季 2021-02-14 07:04

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

5条回答
  •  离开以前
    2021-02-14 08:06

    In Pure Ruby

    Time.now.utc.localtime("+05:30")
    

    where +05:30 (IST) is the offset of the particular zone

提交回复
热议问题