关于NSDateFormatter的格式

来源:互联网 发布:macbook 免费中文软件 编辑:程序博客网 时间:2024/04/28 02:26
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; text-align: center; font: 19.0px 'Arial Unicode MS'}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px 'Arial Unicode MS'}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; text-align: center; font: 16.0px 'Arial Unicode MS'}p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; text-align: right; font: 16.0px 'Arial Unicode MS'}p.p5 {margin: 0.0px 0.0px 8.0px 0.0px; font: 16.0px 'Arial Unicode MS'}span.s1 {text-decoration: underline ; color: #f92b16}table.t1 {margin: 24.0px 0.0px 8.0px 0.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; border-collapse: collapse}table.t2 {margin: 24.0px 186.0px 8.0px 186.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; border-collapse: collapse}td.td1 {width: 58.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; padding: 2.0px 2.0px 2.0px 2.0px}td.td2 {width: 40.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; padding: 2.0px 2.0px 2.0px 2.0px}td.td3 {width: 28.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; padding: 2.0px 2.0px 2.0px 2.0px}td.td4 {width: 93.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; padding: 2.0px 2.0px 2.0px 2.0px}td.td5 {width: 673.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; padding: 2.0px 2.0px 2.0px 2.0px}td.td6 {width: 72.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; padding: 2.0px 2.0px 2.0px 2.0px}td.td7 {width: 45.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; padding: 2.0px 2.0px 2.0px 2.0px}td.td8 {width: 18.0px; border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #000000 #000000 #000000 #000000; padding: 2.0px 2.0px 2.0px 2.0px}

Date Field Symbol Table

Field

Sym.

No.

Example

Description

era

G

1..3

AD

Era - Replaced with the Era string for the current date. One to three letters for the abbreviated form, four letters for the long form, five for the narrow form.

4

Anno Domini

5

A

year

y

1..n

1996

Year. Normally the length specifies the padding, but for two letters it also specifies the maximum length. Example:

Year

y

yy

yyy

yyyy

yyyyy

AD 1

1

01

001

0001

00001

AD 12

12

12

012

0012

00012

AD 123

123

23

123

0123

00123

AD 1234

1234

34

1234

1234

01234

AD 12345

12345

45

12345

12345

12345

Y

1..n

1997

Year (in "Week of Year" based calendars). 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.

u

1..n

4601

Extended year. This is a single number designating the year of this calendar system, encompassing all supra-year fields. For example, for the Julian calendar system, year numbers are positive, with an era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE years and negative values to BCE years, with 1 BCE being year 0.

quarter

Q

1..2

02

Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name.

3

Q2

4

2nd quarter

q

1..2

02

Stand-Alone Quarter - Use one or two for the numerical quarter, three for the abbreviation, or four for the full name.

3

Q2

4

2nd quarter

month

M

1..2

09

Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or five for the narrow name.

3

Sept

4

September

5

S

L

1..2

09

Stand-Alone Month - Use one or two for the numerical month, three for the abbreviation, or four for the full name, or 5 for the narrow name.

3

Sept

4

September

5

S

l

1

*

Special symbol for Chinese leap month, used in combination with M. Only used with the Chinese calendar.

week

w

1..2

27

Week of Year.

W

1

3

Week of Month

day

d

1..2

1

Date - Day of the month

D

1..3

345

Day of year

F

1

2

 

Day of Week in Month. The example is for the 2nd Wed in July

g

1..n

2451334

Modified Julian day. This is different from the conventional Julian day number in two regards. First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; that is, it depends on the local time zone. It can be thought of as a single number that encompasses all the date-related fields.

week

day

E

1..3

Tues

Day of week - Use one through three letters for the short day, or four for the full name, or five for the narrow name.

4

Tuesday

5

T

e

1..2

2

Local day of week. Same as E except adds a numeric value that will depend on the local starting day of the week, using one or two letters. For this example, Monday is the first day of the week.

3

Tues

4

Tuesday

5

T

c

1

2

Stand-Alone local day of week - Use one letter for the local numeric value (same as 'e'), three for the short day, or four for the full name, or five for the narrow name.

3

Tues

4

Tuesday

5

T

period

a

1

AM

AM or PM

hour

h

1..2

11

Hour [1-12].

H

1..2

13

Hour [0-23].

K

1..2

0

Hour [0-11].

k

1..2

24

Hour [1-24].

j

1..2

n/a

This is a special-purpose symbol. It must not occur in patterns, but is reserved for use in APIs doing flexible date pattern generation, and requests the preferred format (12 vs 24 hour) for the language in question.

minute

m

1..2

59

Minute. Use one or two for zero padding.

second

s

1..2

12

Second. Use one or two for zero padding.

S

1..n

3457

Fractional Second - rounds to the count of letters. (example is for 12.34567)

A

1..n

69540000

Milliseconds in day. This field behaves exactly like a composite of all time-related fields, not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This reflects the fact that is must be combined with the offset field to obtain a unique local time value.

zone

z

1..3

PDT

fallbacks:

HPG-8:00

GMT-08:00

Timezone - with the specific non-location format. Where that is unavailable, falls back to localized GMT format. Use one to three letters for the short format or four for the full format. In the short format, metazone names are not used unless the commonlyUsed flag is on in the locale.

For more information about timezone formats, see Appendix J: Time Zone Display Names.

4

Pacific Daylight Time

fallbacks:

HPG-8:00

GMT-08:00

Z

1..3

-0800

Timezone - Use one to three letters for RFC 822 format, four letters for the localized GMT format.

For more information about timezone formats, see Appendix J: Time Zone Display Names.

4

HPG+8:00

fallbacks:

GMT-08:00

v

1

PT

Timezone - with the generic non-location format. Where that is unavailable, uses special fallback rules given in Appendix J. Use one letter for short format, four for long format.

For more information about timezone formats, see Appendix J: Time Zone Display Names.

4

Pacific Time

fallbacks:

Pacific Time (Canada)

Pacific Time (Yellowknife)

United States (Los Angeles) Time

HPG-8:35

GMT-08:35

V

1

PST

fallbacks:

HPG-8:00

GMT-08:00

Timezone - with the same format as z, except that metazone timezone abbreviations are to be displayed if available, regardless of the value of commonlyUsed.

For more information about timezone formats, see Appendix J: Time Zone Display Names.

4

United States (Los Angeles) Time

fallbacks:

HPG-8:35

GMT-08:35

Timezone - with the generic location format. Where that is unavailable, falls back to the localized GMT format. (Fallback is only necessary with a GMT-style Timezone ID, like Etc/GMT-830.)

This is especially useful when presenting possible timezone choices for user selection, since the naming is more uniform than the v format.

For more information about timezone formats, see Appendix J: Time Zone Display Names.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px 'Lucida Grande'}span.s1 {color: #3366cc}


Formatters in Mac OS X v10.6 use version tr35-10.

每个不同系统遵循不同的formatters格式...

谁能知道mac os 10.7又是什么格式..