Last active
November 23, 2018 08:24
-
-
Save muhlenXi/dcd4ead464270278f5726e211ecacbde to your computer and use it in GitHub Desktop.
判断当前设备时间是否是12小时制?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public extension UIDevice { | |
/// 判断当前设备时间是否是12小时制? | |
static func is12HourMode() -> Bool{ | |
if let formatStringForHours = DateFormatter.dateFormat(fromTemplate: "j", options: 0, locale: Locale.current) { | |
return formatStringForHours.contains("a") | |
} | |
return false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment