Reputation: 1709
From this API, it's asking for a timezone in a negative of positive value. What does this mean and how would I produce it in Rails 4?
tz Time zone as negative of positive values. Ex: 6.5
From looking through the Ruby Time API, I can't seem to make sense of where to look exactly. Any help would be awesome!
Upvotes: 0
Views: 299
Reputation: 10592
What you need is gmt_offset
method, it returns difference between GMT and selected time zone (time object) in seconds. Just divide it by 3600 and there you go
Example
t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
t.gmt_offset #=> 0
l = t.getlocal #=> 2000-01-01 14:15:01 -0600
l.gmt_offset #=> -21600
Upvotes: 2