How to get the current time in YYYY-MM-DD HH:MI:Sec.Millisecond format in Java?

后端 未结 15 2378
不思量自难忘°
不思量自难忘° 2020-11-22 15:05

The code below gives me the current time. But it does not tell anything about milliseconds.

public static String getCurrentTimeStamp() {
    SimpleDateForm         


        
15条回答
  •  盖世英雄少女心
    2020-11-22 15:10

    I don't see a reference to this:

    SimpleDateFormat f = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    

    above format is also useful.

    http://www.java2s.com/Tutorials/Java/Date/Date_Format/Format_date_in_yyyyMMddHHmmssSSS_format_in_Java.htm

提交回复
热议问题