Skip to content

Instantly share code, notes, and snippets.

@cybersamx
Last active August 29, 2015 14:04
Show Gist options
  • Save cybersamx/d3f1da8b59d2250e658a to your computer and use it in GitHub Desktop.
Save cybersamx/d3f1da8b59d2250e658a to your computer and use it in GitHub Desktop.
NSDateFormatter date format specifiers
[dateFormatter setDateFormat:@"E, d M y"]; // Output: Sun, 1 5 2011
[dateFormatter setDateFormat:@"EE, dd MM yy"]; // Output: Sun, 01 05 11
[dateFormatter setDateFormat:@"EEE, ddd MMM yyy"]; // Output: Sun, 001 May 2011
[dateFormatter setDateFormat:@"EEEE, dddd MMMM yyyy"]; // Output: Sunday, 0001 May 2011
[dateFormatter setDateFormat:@"EEEEE, ddddd MMMMM yyyyy"]; // Output: S, 00001 M 2011
// Common date format specifiers
//
// y = year
// Q = quarter
// M = month
// w = week of year
// W = week of month
// d = day of the month
// D = day of year
// E = day of week
// a = period (AM or PM)
// h = hour (1-12)
// H = hour (0-23)
// m = minute
// s = second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment