• Home
  • About
  • Our Apps
  • Learn
  • Contact
Login

Register

Login
Seemu Apps Seemu Apps
  • Home
  • About
  • Our Apps
  • Learn
  • Contact

NSDateFormatter Date Format Cheat Sheet

Home cheatsheet NSDateFormatter Date Format Cheat Sheet

NSDateFormatter Date Format Cheat Sheet

Apr 4, 2016 | Posted by Andrew | cheatsheet, reference |

Below is a cheat sheet table for the most common formats needed by NSDateDateFormatter. I found I needed this way to often and always resorted to googling it so here it is for my reference and yours, bookmark it, save it.

Year

Format Description Example
Input Output
y Year, no padding. 1
20
2016
1
20
2016
yy Year with 2 digits. Pads with zeros if necessary. 1
20
2016
01
20
2013
yyy Year with 3 digits. Pads with zeros if necessary. 1
20
2016
001
020
2016
yyyy Year with 4 digits. Pads with zeros if necessary. 1
20
2016
0001
0020
2016

Month

Format Description Example
Input Output
M Numeric month of the year, can be 1 digit. June
1
6
1
MM Numeric month of the year, always 2 digits. June
1
06
01
MMM Three letter abbreviation of the month. June
1
Jun
Jan
MMMM The full name of the month. June
1
June
January
MMMMM One letter abbreviation of the month. Not unique. June
1
J
J

Day

Format Description Example
Input Output
d A day of the month, can be 1 digit. 5
27
5
27
dd A day of the month, 2 digits. Pads with zeros if necessary. 5
27
05
27
E
EE
EEE
Three letter abbreviation of the day. Tuesday
Friday
Tue
Fri
EEEE The full name of the day. Tue
Fri
Tuesday
Friday
EEEEE One letter abbreviation of the day. Not unique. Tuesday
Thursday
Friday
T
T
F
EEEEEEE Two letter abbreviation of the day. Tuesday
Friday
Tu
Fr
F Day of the week and the month. 04/03/2016
Note format is:
DD/MM/YYYY
4th Monday in April

Hour

Format Description Example
Input Output
m The minute, can be 1 digit. 1
21
1
2
mm The minute, pads with zeros if necessary. 1
21
01
21
s The second, can be 1 digit. 7
30
7
30
ss The second, pads with zeros if necessary. 7
30
07
30

You can also see additional information on the formatting here.

Tags: dateformatguideNSDatensdateformatterreference
0
Share

About Andrew

Andrew is a 24 year old from Sydney. He loves developing iOS apps and has done so for two years.

You also might be interested in

Converting a NSDate to a String and String to a NSDate

Mar 30, 2016

Converting a NSDate to a String and back again is[...]

Welcome

Hi I am Andrew and welcome to Seemu Apps! Have a look around, we provide tutorials for primarily iOS apps.
Bluehost website hosting discount

Seemu’s Studio Setup

Blue Yeti Microphone
Rode Stand
Spider Shock Mount
Mac Keyboard Cover
Screenflow - recording software

Contact Us

We're currently offline. Send us an email and we'll get back to you, asap.

Send Message

Footer

:)

© 2025 · Your Website. Theme by HB-Themes.

  • Home
  • About
  • Our Apps
  • Learn
  • Contact
Prev Next