Created
July 13, 2016 21:33
-
-
Save sberrevoets/be17428e862198eb0086c70b498be3f3 to your computer and use it in GitHub Desktop.
Changing NSDateFormatter's time zone
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
let formatter = NSDateFormatter() | |
formatter.dateStyle = .NoStyle | |
formatter.timeStyle = .FullStyle | |
formatter.timeZone = NSTimeZone(name: "America/Los_Angeles") | |
print("1 \(formatter.stringFromDate(NSDate()))") | |
formatter.timeZone = NSTimeZone(name: "America/Chicago") | |
print("2 \(formatter.stringFromDate(NSDate()))") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment