I have dstringas saved in UTC. Although I have a user’s timezone offset standard_offset
I want to display this date in the user’s timezone after conversion. So this is what I do, but in the end you see that it shows UTCnot PSTorPDT
[64] pry> dstring
=> "2013-10-31T23:10:50Z"
[65] pry> standard_offset = -8
=> -8
[66] pry> e = Time.parse(dstring) + (standard_offset * 3600)
=> 2013-10-31 15:10:50 UTC
[67] pry> e.strftime("%m/%m/%Y %I:%M %p %Z")
=> "10/10/2013 03:10 PM UTC"
I expect to finally receive 10/10/2013 03:10 PM PSTHow to get it? Note. This is not a rails app.
source
share