java日期格式化

编程技术  /  houtizong 发布于 3年前   69
用法:
DateFormat  dFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");String currDate = dFormat.format(new Date());System.out.println("现在的时间为:"+currDate1);


补充:模式字母(摘自JDK1.6 SimpleDateFormat )
字母  日期或时间元素  表示  示例 
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 

请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!

留言需要登陆哦

技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成

网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];

      订阅博客周刊 去订阅

文章归档

文章标签

友情链接

Auther ·HouTiZong
侯体宗的博客
© 2020 zongscan.com
版权所有ICP证 : 粤ICP备20027696号
PHP交流群 也可以扫右边的二维码
侯体宗的博客