Created
January 29, 2014 06:43
-
-
Save rwyland/8683010 to your computer and use it in GitHub Desktop.
NSDateFormatter specifiers are a pain, heres a reference.
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
Z: -0500 | |
ZZ: -0500 | |
ZZZ: -0500 | |
ZZZZ: GMT-05:00 | |
z: EST | |
zz: EST | |
zzz: EST | |
zzzz: Eastern Standard Time | |
V: EST | |
VV: | |
VVV: | |
VVVV: United States Time (New York) | |
v: ET | |
vv: | |
vvv: | |
vvvv: Eastern Time | |
NSDateFormatter *f = [[NSDateFormatter alloc] init]; | |
NSDate *date = [NSDate date]; | |
[f setDateFormat:@"Z"]; | |
NSLog(@"Z: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"ZZ"]; | |
NSLog(@"ZZ: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"ZZZ"]; | |
NSLog(@"ZZZ: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"ZZZZ"]; | |
NSLog(@"ZZZZ: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"z"]; | |
NSLog(@"z: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"zz"]; | |
NSLog(@"zz: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"zzz"]; | |
NSLog(@"zzz: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"zzzz"]; | |
NSLog(@"zzzz: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"V"]; | |
NSLog(@"V: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"VV"]; | |
NSLog(@"VV: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"VVV"]; | |
NSLog(@"VVV: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"VVVV"]; | |
NSLog(@"VVVV: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"v"]; | |
NSLog(@"v: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"vv"]; | |
NSLog(@"vv: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"vvv"]; | |
NSLog(@"vvv: %@", [f stringFromDate:date]); | |
[f setDateFormat:@"vvvv"]; | |
NSLog(@"vvvv: %@", [f stringFromDate:date]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment