Skip to content

Instantly share code, notes, and snippets.

@rwyland
Created January 29, 2014 06:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwyland/8683010 to your computer and use it in GitHub Desktop.
Save rwyland/8683010 to your computer and use it in GitHub Desktop.
NSDateFormatter specifiers are a pain, heres a reference.
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