Skip to content

Instantly share code, notes, and snippets.

@simonwhitaker
Created December 29, 2014 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonwhitaker/32eafe4526ff77e81640 to your computer and use it in GitHub Desktop.
Save simonwhitaker/32eafe4526ff77e81640 to your computer and use it in GitHub Desktop.
#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