NSDateFormatter中時間格式串的含義,nsdateformatter

來源:互聯網
上載者:User

NSDateFormatter中時間格式串的含義,nsdateformatter

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 (星期幾全拼)

dd: 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 未知

hh: 1~12 (0 padded Hour (12hr)) 帶0的時, 12小時制

HH: 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 同小寫

ss: 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 of year) 這個年份未知幹嘛用的

YY/YYY: (2 Digits Year, starting from the Sunday of the 1st week of year) 這個年份未知幹嘛用的

z~zzz: (Specific GMT Timezone Abbreviation) 指定GMT時區的編寫

zzzz: (Specific GMT Timezone Name) Z: 

+0000 (RFC 822 Timezone) 指定GMT時區的名稱

 

如:[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss”];

那麼輸出的:2015-02-06 20:07:04

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.