1、以下实例演示了如何使用 SimpleDateFormat 类的 format(date) 方法来格式化时间
首先定义类
SimpleDateFormat f=new SimpleDateFormat(“你所要转换的时间格式”);
SimpleDateFormat saf=new SimpleDateFormat(“yyyy年MM月dd日 HH时mm分ss秒”);
System.out.println(saf.format(new Date()));
2、 输出结果
java学习 时间转化
猜你喜欢
转载自blog.csdn.net/weixin_44594257/article/details/88690088
今日推荐
周排行