Created
May 26, 2015 16:59
-
-
Save danielpunkass/d478448dc6d1832b2aac to your computer and use it in GitHub Desktop.
Example exercising NSDateFormatter with default locale
This file contains hidden or 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
#!/usr/bin/python | |
from Foundation import * | |
form = NSDateFormatter.alloc().init() | |
form.setFormatterBehavior_(1040) | |
form.setDateFormat_("yyyyMMdd'T'HH:mm:ss'Z") | |
form.setTimeZone_(NSTimeZone.timeZoneForSecondsFromGMT_(0)) | |
print "Implied locale is " + NSLocale.currentLocale().localeIdentifier() | |
print form.stringFromDate_(NSDate.date()) | |
# For one of my users, the equivalent of above seems to print | |
# as 12-hour time e.g.: | |
# | |
# 20160525T7:09:43 pmZ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment