iPhone:Find the current timezone offset in HOURS

后端 未结 8 699
萌比男神i
萌比男神i 2021-02-05 03:11

How to find out the current timezone offset on the device in HOURS ?

8条回答
  •  情歌与酒
    2021-02-05 03:55

    Here's an easy way to do this in Swift 3:

    let offsetInHours = Double(TimeZone.current.secondsFromGMT()) / 3600.0

提交回复
热议问题