Meaning of time strings in NSDateFormatter, nsdateformatter
A: AM/PM (morning/afternoon)
A: 0 ~ 86399999 (the second microsecond Of A day)
C/cc: 1 ~ 7 (the first day of the week, the day of the week is 1)
Ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat (abbreviated as the day of the week)
Cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday)
Dd: 1 ~ 31 (the day of the month, with 0)
D: 1 ~ 366 (the day of the year, with 0)
E: 1 ~ 7 (the day of the week, with 0)
E ~ EEE: Sun/Mon/Tue/Wed/Thu/Fri/Sat (abbreviated as the day of the week)
EEEE: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday)
F: 1 ~ 5 (the week of the month, and the first day of the week is Monday)
G: Julian Day Number (number of days since 4713 BC January 1) unknown
G ~ GGG: BC/AD (Era Designator Abbreviated) unknown
GGGG: Before Christ/Anno Domini unknown
Hh: 1 ~ 12 (0 padded Hour (12hr) in 12-Hour format with 0
HH: 0 ~ 23 (0 padded Hour (24hr) in 24-Hour format with 0
K: 1 ~ 24 (0 padded Hour (24hr) with 0, in 24-Hour format
K: 0 ~ 11 (0 padded Hour (12hr) in 12-Hour format with 0
L/LL: 1 ~ 12 (0 padded Month) months
LLL: Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec month abbreviation
LLLL: January/February/March/Jun L/May/June/July/August/September/October/November/December full name
M: 0 ~ 59 (0 padded Minute) minutes
M/MM: 1 ~ 12 (0 padded Month) months
MMM: Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec
MMMM: January/February/March/April/May/June/July/August/September/October/November/December
Q/qq: 1 ~ 4 (0 padded Quarter) Quarter
Qqq: Short for Q1/Q2/Q3/Q4 quarter
Qqqq: 1st quarter/2nd quarter/3rd quarter/4th quarter
Q/QQ: 1 ~ 4 (0 padded Quarter) in the same lower case
QQQ: Q1/Q2/Q3/Q4 in the same lower case
QQQQ: 1st quarter/2nd quarter/3rd quarter/4th quarter in the same lower case
Ss: 0 ~ 59 (0 padded Second) seconds
S: (rounded Sub-Second) unknown
U: (0 padded Year) unknown
V ~ Vvv: (General GMT Timezone Abbreviation) Compiling of the normal GMT Time Zone
Vvvv: (General GMT Timezone Name) Name of the General GMT Time Zone
W: 1 ~ 53 (0 padded Week of Year, 1st day of week = Sunday, NB: 1st week of year starts from the last Sunday of last year) Week of the Year, the week starts with Sunday, and the first week starts from the last Sunday of last year.
W: 1 ~ 5 (0 padded Week of Month, 1st day of week = Sunday) Week of a Month
Y/yyyy: (Full Year) complete Year
Yy/yyy: (2 Digits Year) Year of 2 Digits
Y/YYYY: (Full Year, starting from the Sunday of the 1st week of year)
YY/YYY: (2 Digits Year, starting from the Sunday of the 1st week of year)
Z ~ Zzz: (Specific GMT Timezone Abbreviation) specifies the GMT time zone.
Zzzz: (Specific GMT Timezone Name) Z:
+ 0000 (RFC 822 Timezone) specifies the GMT Time Zone name
For example, [dateFormatter setDateFormat: @ "yyyy-MM-dd HH: mm: ss"];
Then output:20:07:04