Created
December 29, 2014 08:59
-
-
Save simonwhitaker/32eafe4526ff77e81640 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
#import <Foundation/Foundation.h> | |
int main(int argc, char *argv[]) { | |
@autoreleasepool { | |
NSDateFormatter *goodDateFormatter = [[NSDateFormatter alloc] init]; | |
goodDateFormatter.dateFormat = @"dd-MM-yyyy HH:mm:ss.SSS"; | |
NSDateFormatter *badDateFormatter = [[NSDateFormatter alloc] init]; | |
badDateFormatter.dateFormat = @"dd-MM-YYYY HH:mm:ss.SSS"; | |
NSDate *now = [NSDate date]; | |
printf("Good: %s\n", [[goodDateFormatter stringFromDate:now] UTF8String]); | |
printf("Bad: %s\n", [[badDateFormatter stringFromDate:now] UTF8String]); | |
} | |
} | |
/* | |
Output: | |
Good: 29-12-2014 08:53:43.114 | |
Bad: 29-12-2015 08:53:43.114 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment