Generally
people don't remember the formats string while they use
NSDateFormatter. This reference will provide a easy to remember quick
guides.
- y = year
- Y = Year (This year designation is used in ISO year-week calendar as defined by ISO 8601, but can be used in non-Gregorian based calendar systems where week date processing is desired. May not always be the same value as calendar 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
- z = zone
Commonly
used NSDateFormat String -
@"E,
d M y" - Mon, 1 5 2015
@"EE,
dd MM yy" - Mon, 01 05 15
@"EEE,
ddd MMM yyy" - Mon, 001 May 2015
@"EEEE,
dddd MMMM yyyy - Monday, 0001 May 2015
@"dd-MM-yyyy" - 01-05- 2015
@"dd-MM-yyyy
HH:mm:ss" - 01-05- 2015 15:10:10
@"dd-MM-yyyy
hh:mm:ss a" - 01-05- 2015 10:15:12 AM
@"EEE,
dd MMM yyyy HH:mm:ss Z" - Mon,
06 Sep 2009 16:45:00 -0900
Awesome post to find out the way how to create date format in iOS
ReplyDelete