Created
October 26, 2015 15:41
-
-
Save mattyohe/9c8be0ff213c3929663e to your computer and use it in GitHub Desktop.
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
func badDateFormatter(date: NSDate) -> String { | |
let formatter = NSDateFormatter() | |
formatter.dateFormat = "YYYY" | |
return formatter.stringFromDate(date) | |
} | |
func christmasUTCWithOffset(offset: Int) -> NSDate { | |
return NSDate(timeIntervalSince1970: 1451001600 + (Double(offset) * 86400.0)) | |
} | |
(0...3).forEach { | |
let date = christmasUTCWithOffset($0) | |
let year = badDateFormatter(date) | |
print(date) | |
print(year) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prints: