Skip to content

Instantly share code, notes, and snippets.

@Garfeild
Created April 9, 2014 16:41
Show Gist options
  • Save Garfeild/10290336 to your computer and use it in GitHub Desktop.
Save Garfeild/10290336 to your computer and use it in GitHub Desktop.
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterFullStyle];
[dateFormatter setDateStyle:NSDateFormatterFullStyle];
NSDate *date1 = [NSDate dateWithTimeIntervalSinceNow:0];
NSDate *date2 = nil;
NSString *string = [dateFormatter stringFromDate:date1];
date2 = [dateFormatter dateFromString:string];
// [date1 isEqualToDate:date2] will return NO.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment