Created
May 26, 2015 17:02
-
-
Save danielpunkass/3bdf62e3646e8d3ee1af to your computer and use it in GitHub Desktop.
Testing locale and date formatting
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