Skip to content

Commit

Permalink
Merge branch 'iso8601' of https://github.com/huguesbr/nsdate-helper i…
Browse files Browse the repository at this point in the history
…nto huguesbr-iso8601
  • Loading branch information
billymeltdown committed Mar 17, 2016
2 parents 820d56e + 230c112 commit 3c714d3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions NSDate+Helper.m
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ - (NSString *)stringWithFormat:(NSString *)format {
return timestamp_str;
}

- (NSString *)stringWithFormatISO8601; {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
[dateFormatter setLocale:enUSPOSIXLocale];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];
return [dateFormatter stringFromDate:self];
}

- (NSString *)string {
return [self stringWithFormat:[NSDate dbFormatString]];
}
Expand Down

0 comments on commit 3c714d3

Please sign in to comment.