Skip to content

Instantly share code, notes, and snippets.

@Sherlouk
Created May 29, 2016 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sherlouk/8d046a916b34a9d2900344191f369a89 to your computer and use it in GitHub Desktop.
Save Sherlouk/8d046a916b34a9d2900344191f369a89 to your computer and use it in GitHub Desktop.
NSDateFormatter Cheatsheet
a: AM/PM
s: 1/59 - Seconds
ss: 01/59 - Seconds w/ Leading
m: 1/59 - Minutes
mm: 01/59 - Minutes w/ Leading
h: 5/10 (5AM, 10PM) - 12hr Clock
hh: 05/10 (5AM, 10PM) - 12hr Clock w/ Leading
H: 5/22 (5AM, 10PM) - 24hr Clock
HH: 05/22 (5AM, 10PM) - 24hr Clock w/ Leading
c: 1/6 - Day of Week (Starts with Monday)
ccc: Mon/Sat - Day of Week
cccc: Monday/Saturday - Day of Week
d: 1/31 - Day of Month
dd: 01/31 - Day of Month w/ Leading
M: 1/12 - Month of year
MM: 01/12 - Month of year w/ Leading
MMM: Feb/Dec - Month of year
MMMM: February/December - Month of year
yy: 15/16 - Year
yyyy: 2015/2016 - Year w/ Leading
Convenient Formats
"July 2016" = "MMMM yyyy"
"23/07/1997" = "d/M/yyyy"
"9:30am" = "h:m a"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment