程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> NSDateFormatter 格式整理

NSDateFormatter 格式整理

編輯:C++入門知識

[formattersetLocale:[[[NSLocale alloc]initWithLocaleIdentifier:@"en_US"] [formatter setAMSymbol:@"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 SymbolTable Field Sym. No. Example Description era G 1..3 AD Era -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. 4 Anno Domini 5 A year y 1..n 1996 Year. Normally the length specifies the padding, but for twoletters 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 (of "Week of Year"), used in ISO year-week calendar. Maydiffer from calendar year. u 1..n 4601 Extended 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 Q 1..2 02 Quarter - Use one or two for the numerical quarter, three for theabbreviation, or four for the full name. 3 Q2 4 2nd quarter q 1..2 02 Stand-Alone Quarter - Use one or two for the numericalquarter, three for the abbreviation, or four for the fullname. 3 Q2 4 2nd quarter month M 1..2 09 Month- Use one or two for the numerical month, three for theabbreviation, or four for the full name, or five for the narrowname. 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 thenarrow name. 3 Sept 4 September 5 S 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 inJuly g 1..n 2451334 Modified 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 E 1..3 Tues Dayof week - Use one through three letters for the short day, or fourfor the full name, or five for the narrow name. 4 Tuesday 5 T e 1..2 2 Localday 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. 3 Tues 4 Tuesday 5 T c 1 2 Stand-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. 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]. 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 isfor 12.34567) A 1..n 69540000 Milliseconds 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 z 1..3 PDT Timezone - Use one to three letters for the short timezone or fourfor the full name. For more information, see AppendixJ: Time Zone Display Names 4 Pacific DaylightTime Z 1..3 -0800 Useone to three letters for RFC 822, four letters for GMT format. 4 GMT-08:00 v 1 PT Useone letter for short wall (generic) time, four for long wall time.For more information, see AppendixJ: Time Zone Display Names 4 Pacific Time All 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.  

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved