Created
June 7, 2012 08:04
-
-
Save jessedc/2887327 to your computer and use it in GitHub Desktop.
DateFormatter stuffs
This file contains 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
NSDateFormatter *timeOfArrival = [[NSDateFormatter alloc] init]; | |
[timeOfArrival setTimeStyle:NSDateFormatterLongStyle]; | |
[timeOfArrival setDateStyle:NSDateFormatterNoStyle]; | |
[timeOfArrival setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]]; | |
NSString *etaStr = [attributeDict objectForKey:@"cumulativeTime"]; | |
NSLog(@"%@", etaStr); | |
checkpoint.eta = [timeOfArrival dateFromString:etaStr]; | |
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; | |
[formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]]; | |
[formatter setDateFormat:@"HH:mm:ss"]; | |
NSString *etaStr = @"00:14:00"; | |
NSLog(@"%@", [formatter stringFromDate:[formatter dateFromString:etaStr]]); | |
[formatter release]; | |
00:14:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment