Created
April 7, 2016 13:24
-
-
Save phil-hudson/cf1fd720349453b7819dc9d7a0935203 to your computer and use it in GitHub Desktop.
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
import UIKit | |
func localizedDate() -> NSDate { | |
let now: NSDate = NSDate() | |
let timeZone: NSTimeZone = NSTimeZone.localTimeZone() | |
let secondsOffset = timeZone.secondsFromGMTForDate(now) | |
let localTimeZoneDate: NSDate = now.dateByAddingTimeInterval(Double(secondsOffset)) | |
return localTimeZoneDate | |
} | |
print("Localized date") | |
print(localizedDate()) | |
print("NSDate()") | |
print(NSDate()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment