b2cloud

17th November 2012

NSDateFormatter format strings

Guides By 4 years ago

Every time I bookmark one of these lists it seems to disappear soon after, so it’s time to make my own (laid out to my liking):

FormatDescriptionAllows 0 paddingExample
aPeriodXAM/PM
AMillisecond of Day0-86399999
sSecond0-59
mMinute0-59
hHour (12hr)1-12
HHour (24hr)0-24
dDay of Month1-31
DDay of Year1-366
cDay of WeekX1-7
cccDay of Week (Abbreviated)XSun/Mon/Tue…
ccccDay of WeekXSunday/Monday/…
WWeek of Month1-5
wWeek of Year1-53
MMonth1-12
MMMMonth (Abbreviated)XJan/Feb/Mar…
MMMMMonthXJanuary/February/…
y/yyyyYear2012/2013/…
yyYear (2 digits)X12/13/…
qQuarter1-4
qqqQuarter (short)XQ1/Q2/Q3/Q4
qqqqQuarter (long)1st quarter/2nd…
gJulian Day (days since 4713 BC)2456200
GEra (Abbreviated)XBC/AD
GGGGEraXBefore Christ/
Anno Domini
vGeneral Timezone (Abbreviated)XAET
vvvvGeneral TimezoneXEastern Australia Time
zTimezone (Abbreviated)XAEDT
zzzzTimezoneXAustralian Eastern Daylight Time
ZGMT OffsetX+1100
  • cwagdev

    Thank you! I have the same experience.

  • Yea, same here. Thanks for doing this. I’ve bookmarked it now, hopefully this won’t disappear aswell…

  • Rainier Wolfcastle

    Why on earth have Apple NOT added this to the documentation? And if it’s there, why in God’s name can’t I find it? Apple’s docs are horrible!

Recommended Posts

Hey Siri, how do I start a conversation with someone with a disability?

Post by 4 years ago

We all love Siri’s little witty quips, but I recently read a heartwarming article over on Mashable that reflects the power of technology to change lives in ways that most of us would never appreciate. I won’t spoil

Got an idea?

We help entrepreneurs, organizations and established brands from around
the country bring ideas to life. We would love to hear from you!