我遇到的问题:
In the case of the United States where a one-hour shift occurs at 02:00 local time, in spring the clock jumps forward from the last moment of 01:59 standard time to 03:00 DST and that day has 23 hours, whereas in autumn the clock jumps backward from the last moment of 01:59 DST to 01:00 standard time, repeating that hour, and that day has 25 hours.[37] A digital display of local time does not read 02:00 exactly at the shift to summer time, but instead jumps from 01:59:59.9 forward to 03:00:00.0.
并且 UIDatePicker
没有机会在 DST 发生时设置 02:00:00 时间。如何在 UIDatePicker
中修复能够选择那个时间?
最佳答案
NSTimeZone是定义时区对象行为的抽象类。时区对象代表地缘政治区域。夏令时也由该类管理。它可以通过以下方式之一完成:
系统时区: 系统当前使用的时区。如果无法确定当前时区,则返回 GMT 时区。
默认时区: 当前应用程序的默认时区。如果未设置默认时区,则此方法调用 systemTimeZone 并返回系统时区。
本地时区: 将所有消息转发到当前应用程序的默认时区的对象。本地时区始终代表默认时区的当前状态。
使用 localTimeZone 类方法,您可以获得一个相对时区对象,该对象将自身解码为它所在的任何计算机上的默认时区。
关于ios - 夏令时 UIDatePicker 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34416090/