-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get UTC Offset as integer #353
Comments
You can use access the offset of a specific julia> using TimeZones
julia> now(tz"America/New_York").zone.offset
UTC-5/+1
julia> string(ans)
"-04:00" If this is something you're just wanting to view for yourself you can do: julia> show_next_transition(tz"America/New_York")
Transition Date: 2021-11-07
Local Time Change: 02:00 → 01:00 (Backward)
Offset Change: UTC-5/+1 → UTC-5/+0
Transition From: 2021-11-07T01:59:59.999-04:00 (EDT)
Transition To: 2021-11-07T01:00:00.000-05:00 (EST) Which shows the current offset in "Offset Change" as well as a other information. |
@omus Thank you! Can we add an int(timezoneawaretime) to make integer conversion easier? |
It would be nice to have something like function get_offset_seconds(zdt)
offset = FixedTimeZone(zdt).offset
return offset.dst + offset.std
end as part of the API. The issue with the string version is that it will show as eg julia> zdt1 = ZonedDateTime(2014, 5, 30, 21, tz"America/New_York")
2014-05-30T21:00:00-04:00
julia> string(FixedTimeZone(zdt1))
"EDT" |
I do think we can support a nice way of extracting the offset information than we currently have. Some considerations we need to keep in mind:
|
Completely agree with above comments. This required some googling, and I ended up here. +1
If I understand correctly, the 'standard' offset would be referred to as the Meridian offset. For my specific application I need this value to compute the Local Standard Time Meridian. |
The terminology used in TimeZones.jl is mainly based upon https://data.iana.org/time-zones/code/theory.html. In most cases uses want the standard offset and daylight saving offset added together. |
How can I get the current UTC offset from
tz"America/New_York"
?The text was updated successfully, but these errors were encountered: