Skip to content

How to get hour from Offset? #81

Closed Answered by BurntSushi
azzamsa asked this question in Q&A
Discussion options

You must be logged in to vote

offset.seconds() / (60 * 60) should do the trick.

We can consider adding offset.hours() and offset.minutes() methods to make this easier. But I'm curious, what are you trying to do with the hours from an offset? (And specifically, this would ignore any minute or second component, since an offset isn't necessarily a whole number of hours.)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@azzamsa
Comment options

Answer selected by azzamsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants