当前位置: 移动技术网 > IT编程>开发语言>Java > java Date类

java Date类

2020年04月10日  | 移动技术网IT编程  | 我要评论
public class datedemo {
    public static void main(string[] args) {
        date d = new date();
        system.out.println(d);//打印的时间看不懂,希望有些格式
        //将模式封装到simpledateformat中。
        simpledateformat sdf = new simpledateformat("yyyy年mm月dd日 e hh:mm:ss");// time:2020年04月10日 星期五 01:23:08
        //调用format让模式格式化指定date对象。
        string time = sdf.format(d);
        system.out.println("time:"+time);
    }
}

 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网