有人知道在Swift中獲取用戶時區的方法嗎?我正在從數據庫中取出電視上的特定時間,然后需要從它們所在的位置減去/添加,以向他們顯示正確的時間。
3 回答

森林海
TA貢獻2011條經驗 獲得超2個贊
您可以使用以下代碼獲取當前時區
func getCurrentTimeZone() -> String{
return TimeZone.current.identifier
}
let currentTimeZone = getCurrentTimeZone()
print(currentTimeZone)
- 3 回答
- 0 關注
- 987 瀏覽
添加回答
舉報
0/150
提交
取消