java 获取当前时间

来源:互联网 发布:手机淘宝联盟登录失效 编辑:程序博客网 时间:2024/06/07 00:41
    Long time=System.currentTimeMillis();
    Date date=new Date(time);
    String mat="yyyy-MM-dd";
    String ma="yyyyMMdd";
    SimpleDateFormat format=new SimpleDateFormat(mat);
    SimpleDateFormat forma=new SimpleDateFormat(ma);
    String nowdate=format.format(date);
    String nwdate=forma.format(date);
    int x=Integer.parseInt(nwdate);
    System.out.println(nowdate);
    System.out.println(nwdate);
    System.out.println(x);  
    System.out.println(date);
0 0
原创粉丝点击