NSDateFormatter 格式整理[formattersetLocale:[[[NSLocale alloc]initWithLocaleIdentifier:@en_US][fo
NSDateFormatter 格式整理
[formattersetLocale:[[[NSLocale alloc]initWithLocaleIdentifier:@"en_US"]
[formattersetAMSymbol:@"AM"];
[formattersetPMSymbol:@"PM"];
autorelease]];
yyyy 4位年
MM 月
d~dd 日
hh 时
HH 24小时
mm 分
ss 秒
a~aaa AM/PM
EEE 英文星期
MMM 英文月
Z~ZZZ 时区
ZZZZ
K
G~GGG AD
a: AM/PM (上午/下午)
A: 0~86399999 (一天的第A微秒)
c/cc: 1~7 (一周的第一天, 周天为1)
ccc: Sun/Mon/Tue/Wed/Thu/Fri/Sat (星期几简写)
cccc: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday(星期几全拼)
d: 1~31 (月份的第几天, 带0)
D: 1~366 (年份的第几天,带0)
e: 1~7 (一周的第几天, 带0)
E~EEE: Sun/Mon/Tue/Wed/Thu/Fri/Sat (星期几简写)
EEEE: Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday(星期几全拼)
F: 1~5 (每月的第几周, 一周的第一天为周一)
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)) 带0的时, 12小时制
H: 0~23 (0 padded Hour (24hr)) 带0的时, 24小时制
k: 1~24 (0 padded Hour (24hr) 带0的时, 24小时制
K: 0~11 (0 padded Hour (12hr)) 带0的时, 12小时制
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) 常规GMT时区的编写
vvvv: (General GMT Timezone Name) 常规GMT时区的名称
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) 一年的第几周,一周的开始为周日,第一周从去年的最后一个周日起算
W: 1~5 (0 padded Week of Month, 1st day of week = Sunday)一个月的第几周
y/yyyy: (Full Year) 完整的年份
yy/yyy: (2 Digits Year) 2个数字的年份
Y/YYYY: (Full Year, starting from the Sunday of the 1st week ofyear) 这个年份未知干嘛用的
YY/YYY: (2 Digits Year, starting from the Sunday of the 1st weekof year) 这个年份未知干嘛用的
z~zzz: (Specific GMT Timezone Abbreviation) 指定GMT时区的编写
zzzz: (Specific GMT Timezone Name) Z: +0000 (RFC 822 Timezone)指定GMT时区的名称
Date Field SymbolTableField | Sym. | No. | Example | Description | era | G1..3ADEra -Replaced with the Era string for the current date. One to threeletters for the abbreviated form, four letters for the long form,five for the narrow form.4Anno Domini5A
year | y1..n1996Year. Normally the length specifies the padding, but for twoletters it also specifies the maximum length. Example:
Year | y | yy | yyy | yyyy | yyyyy | AD 1101001000100001AD 121212012001200012AD 12312323123012300123AD 12341234341234123401234AD 123451234545123451234512345Y1..n1997Year (of "Week of Year"), used in ISO year-week calendar. Maydiffer from calendar year.u1..n4601Extended year. This is a single number designating the year ofthis calendar system, encompassing all supra-year fields. Forexample, for the Julian calendar system, year numbers are positive,with an era of BCE or CE. An extended year value for the Juliancalendar system assigns positive values to CE years and negativevalues to BCE years, with 1 BCE being year 0.
quarter | Q1..202Quarter - Use one or two for the numerical quarter, three for theabbreviation, or four for the full name.3Q242nd quarterq1..202
Stand-Alone Quarter - Use one or two for the numericalquarter, three for the abbreviation, or four for the fullname.3Q242nd quarter
month | M1..209Month- Use one or two for the numerical month, three for theabbreviation, or four for the full name, or five for the narrowname.3Sept4September5SL1..209
Stand-Alone Month - Use one or two for the numerical month,three for the abbreviation, or four for the full name, or 5 for thenarrow name.3Sept4September5S
week | w1..227Week of Year.W13Week of Month
day | d1..21Date - Day of the monthD1..3345Day of yearF12
Day of Week in Month. The example is for the 2nd Wed inJulyg1..n2451334Modified Julian day. This is different from the conventionalJulian day number in two regards. First, it demarcates days atlocal zone midnight, rather than noon GMT. Second, it is a localnumber; that is, it depends on the local time zone. It can bethought of as a single number that encompasses all the date-relatedfields.week day | E1..3TuesDayof week - Use one through three letters for the short day, or fourfor the full name, or five for the narrow name.4Tuesday5Te1..22Localday of week. Same as E except adds a numeric value that will dependon the local starting day of the week, using one or two letters.For this example, Monday is the first day of the week.3Tues4Tuesday5Tc12Stand-Alone local day of week - Use one letter for the localnumeric value (same as 'e'), three for the short day, or four forthe full name, or five for the narrow name.3Tues4Tuesday5Tperiod | a1AMAM or PMhour | h1..211Hour [1-12].H1..213Hour [0-23].K1..20Hour [0-11].k1..224Hour [1-24].minute | m1..259Minute. Use one or two for zero padding.second | s1..212Second. Use one or two for zero padding.S1..n3457Fractional Second - rounds to the count of letters. (example isfor 12.34567)A1..n69540000Milliseconds in day. This field behaves exactly like acomposite of all time-related fields, not including the zonefields. As such, it also reflects discontinuities of those fieldson DST transition days. On a day of DST onset, it will jumpforward. On a day of DST cessation, it will jump backward. Thisreflects the fact that is must be combined with the offset field toobtain a unique local time value.zone | z1..3PDTTimezone - Use one to three letters for the short timezone or fourfor the full name. For more information, seeAppendixJ: Time Zone Display Names4Pacific DaylightTimeZ1..3-0800Useone to three letters for RFC 822, four letters for GMT format.4GMT-08:00v1PTUseone letter for short wall (generic) time, four for long wall time.For more information, seeAppendixJ: Time Zone Display Names4Pacific TimeAll non-letter character represent themselves in a pattern,except for the single quote. It is used to 'escape' letters. Twosingle quotes in a row, whether inside or outside a quotedsequence, represent a 'real' single quote.