小菜学习日记—Java中new Date()获取当前时间

来源:互联网 发布:手机测评软件 编辑:程序博客网 时间:2024/05/16 05:19

代码块

使用Date()获取系统当前时间并于System.currentTimeMillis()比较,例如:

        Date d = new Date();        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");         System.out.println(d.getTime());        System.out.println(df.format(d));        System.out.println(System.currentTimeMillis());
15021588009612017-08-08 10:20:001502158801447
阅读全文
0 0