[Iphone development] NSDateFormatter format string

Source: Internet
Author: User
Tags julian day
a:am/pm
a:0~86399999 (millisecond of day)

C/cc:1~7 (Day of Week)
Ccc:sun/mon/tue/wed/thu/fri/sat
Cccc:sunday/monday/tuesday/wednesday/thursday/friday/saturday

D:1~31 (0 padded day of Month)
d:1~366 (0 padded day of the year)

E:1~7 (0 padded day of Week)
E~eee:sun/mon/tue/wed/thu/fri/sat
Eeee:sunday/monday/tuesday/wednesday/thursday/friday/saturday

F:1~5 (0 padded Week of Month, day of Week = Monday)

G:julian Day number (number of days since 4713 BC January 1)
G~ggg:bc/ad (Era designator abbreviated)
Gggg:before Christ/anno Domini

H:1~12 (0 padded Hour (12hr))
h:0~23 (0 padded Hour (24hr))

K:1~24 (0 padded Hour (24hr)
K:0~11 (0 padded Hour (12hr))

L/LL:1~12 (0 padded Month)
Lll:jan/feb/mar/apr/may/jun/jul/aug/sep/oct/nov/dec
Llll:january/february/march/april/may/june/july/august/september/october/november/december

m:0~59 (0 padded Minute)
M/MM:1~12 (0 padded Month)
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)
Qqq:q1/q2/q3/q4
qqqq:1st quarter/2nd quarter/3rd quarter/4th Quarter
Q/qq:1~4 (0 padded quarter)
Qqq:q1/q2/q3/q4
qqqq:1st quarter/2nd quarter/3rd quarter/4th Quarter

s:0~59 (0 padded Second)
S: (Rounded sub-second)

U: (0 padded year)

V~VVV: (General GMT Timezone abbreviation)
VVVV: (General GMT Timezone Name)

w:1~53 (0 padded Week of year, 1st/Week = Sunday, nb:1st Week of year starts to last Sunday
W:1~5 (0 padded Week of Month, 1st day of Week = Sunday)

Y/YYYY: (Full year)
YY/YYY: (2 Digits year)
Y/YYYY: (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)
ZZZZ: (Specific GMT Timezone Name)

Z: +0000 (RFC 822 Timezone)


Turn from: http://www.alexcurylo.com/blog/2009/01/29/nsdateformatter-formatting/

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.