It’s because you are not setting the date formatter’s locale to the special en_US_POSIX
locale. Most likely your iPhone 5 has a different setting for the 24-hour setting.
You need to set the special locale whenever you parse a fixed format string.
More Related Contents:
- Difference between ‘YYYY’ and ‘yyyy’ in NSDateFormatter
- Date Format in Swift
- DateFormatter’s returns nil for specific date strings without time in Swift
- Convert string with unknown format (any format) to date
- How do I get an ISO 8601 date on iOS?
- How to convert NSDate in to relative format as “Today”,”Yesterday”,”a week ago”,”a month ago”,”a year ago”?
- swift NSDateFormatter not working
- Unexpected value from NSDate
- Get current iPhone device timezone date and time from UTC-5 timezone date and time iPhone app?
- Convert date string swift
- How do I convert a date/time string into a different date string?
- Calculate next date in week
- String extensions toDate() is crash some device
- Converting NSString to NSDate (and back again)
- Getting the difference between two Dates (months/days/hours/minutes/seconds) in Swift
- How can I convert string date to NSDate?
- Number of days between two NSDates [duplicate]
- iOS: Convert UTC NSDate to local Timezone
- How do I get the day of the week with Foundation?
- first and last day of the current month in swift
- Black bars on launch screen on iPhone5 (and iPhone6)
- How to create Custom MKAnnotationView and custom annotation title and subtitle
- How to add iPhone 5 large screen support to iOS apps in Xcode? [duplicate]
- Get UTC time and local time from NSDate object
- Current Week Start and End Date
- How to switch to different Storyboard for iPhone 5?
- What is the best way to deal with the NSDateFormatter locale “feature”?
- Comparing NSDates without time component
- How can I set an NSDate object to midnight?
- NSDateFormatter doesn’t show time zone abbreviation for “Asia/Kolkata” for the “z” or “zzz” specifier, just the GMT offset