天天看點

java格式化時間使用的模式字母大全

版權聲明:本文為部落客原創文章,如需轉載,請标明出處。 https://blog.csdn.net/alan_liuyue/article/details/71190853

字母    含義                類型          表現形式

 G    Era 标志符             Text          AD  

 y    年                    Year        1996; 96  

 M    年中的月份             Month     July; Jul; 07  

 w    年中的周數             Number        27  

 W    月份中的周數           Number         2  

 D    年中的天數             Number        189  

 d    月份中的天數           Number        10  

 F    月份中的星期           Number         2  

 E    星期中的天數           Text      Tuesday; Tue  

 a    Am/pm 标記             Text          PM  

 H    一天中的小時數(0-23)   Number         0  

 k    一天中的小時數(1-24)   Number        24  

 K    am/pm 中的小時數(0-11) Number         0  

 h    am/pm 中的小時數(1-12) Number        12  

 m    小時中的分鐘數         Number         30  

 s    分鐘中的秒數           Number        55  

 S    毫秒數                Number        978  

 z    時區          General time zone   Pacific Standard Time; PST; GMT-08:00  

 Z    時區          RFC 822 time zone      -0800

使用提醒:字母大小寫敏感