美文网首页Java
Java timestamp

Java timestamp

作者: JaedenKil | 来源:发表于2018-01-29 18:43 被阅读4次

    This code can be used to print time line and generate timestamp:

    private static void printTimestamp() {
      Long ts = System.currentTimeMillis();
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
      SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMddHHmmssSSS");
      Date date = new Date(ts);
      System.out.println("Date: " + sdf.format(date));
      System.out.println("Timestamp: " + sdf2.format(date));
    }
    

    相关文章

      网友评论

        本文标题:Java timestamp

        本文链接:https://www.haomeiwen.com/subject/wurfzxtx.html