[IOS Development] NSDateFormatter's format string--"collated notes"

Source: Internet
Author: User
Tags gmt time zone time zones julian day

In iOS development, the nsdate in Objective-c is a nasty type, you can't find a type to convert to a string, and you have to take a nsdateformatter type.

The official document on the NSDateFormatter format string seems to have not been detailed, perhaps, I did not find, every use is Google groping.
Lucky to find a more comprehensive document, translated to share:


A:AM/PM (morning/afternoon)
a:0~86399999 (the first microsecond of the day)
C/cc:1~7 (the first day of the week, Sunday is 1)
Ccc:sun/mon/tue/wed/thu/fri/sat (abbreviated day of the week)
Cccc:sunday/monday/tuesday/wednesday/thursday/friday/saturday (Day of the Week full spell)
D:1~31 (day ordinal of the month, with 0)
d:1~366 (day ordinal of the year, with 0)
E:1~7 (Day of the week, with 0)
E~eee:sun/mon/tue/wed/thu/fri/sat (abbreviated day of the week)
Eeee:sunday/monday/tuesday/wednesday/thursday/friday/saturday (Day of the Week full spell)
F:1~5 (Week of the month, 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
H:1~12 (0 padded Hour (12hr)) with 0, 12-hour
h:0~23 (0 padded Hour (24hr)) with 0, 24-hour
K:1~24 (0 padded Hour (24hr) with 0, 24-hour
K:0~11 (0 padded Hour (12hr)) with 0, 12-hour
L/LL:1~12 (0 padded month) The first few months
Lll:jan/feb/mar/apr/may/jun/jul/aug/sep/oct/nov/dec month abbreviation
Llll:january/february/march/april/may/june/july/august/september/october/november/december Month Full Name
m:0~59 (0 padded Minute) min
M/MM:1~12 (0 padded month) The first few 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) First quarter
Qqq:q1/q2/q3/q4 Quarterly Shorthand
qqqq:1st quarter/2nd quarter/3rd quarter/4th Quarter Quarter full spell
Q/qq:1~4 (0 padded Quarter) with lowercase
Qqq:q1/q2/q3/q4 with lowercase
qqqq:1st quarter/2nd quarter/3rd quarter/4th Quarter with lowercase
s:0~59 (0 padded Second) Number of seconds
S: (rounded sub-second) unknown
U: (0 padded year) unknown
V~VVV: (general GMT Timezone abbreviation) Preparation of the regular GMT time zone
VVVV: (general GMT Timezone name) The names of the regular GMT time zones
w:1~53 (0 padded Week of the year, 1st day of Week = Sunday, nb:1st Week of the starts by the last Sunday of Week, beginning of Sunday, first week from last Sunday of last year
W:1~5 (0 padded Week of month, 1st day of Week = Sunday) The first week of one months
Y/YYYY: Complete Year
YY/YYY: (2 Digits year) 2 number of years
Y/YYYY: (full year, starting from the Sunday of the 1st week of years) what's the use of this vintage?
YY/YYY: (2 Digits years, starting from the Sunday of the 1st week for year) what's the use of this vintage?
Z~zzz: (Specific GMT Timezone abbreviation) Specifies the GMT time zone to be written
ZZZZ: (Specific GMT Timezone name) Z: +0000 (RFC 822 Timezone) Specify the name of the GMT time zone

[IOS Development] NSDateFormatter's format string--"collated notes"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.