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

后端 未结 15 2198
不思量自难忘°
不思量自难忘° 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:19

    I would use something like this:

    String.format("%tF %

    Variable dateTime could be any date and/or time value, see JavaDoc for Formatter.

提交回复
热议问题