How to get current timestamp in string format in Java? “yyyy.MM.dd.HH.mm.ss”

前端 未结 7 838
天涯浪人
天涯浪人 2020-12-04 06:27

How to get timestamp in string format in Java? \"yyyy.MM.dd.HH.mm.ss\"

String timeStamp = new SimpleDateFormat(\"yyyy.MM.dd.HH.mm.ss\").format(new Timestamp(         


        
7条回答
  •  醉梦人生
    2020-12-04 07:14

    You can use the following

    new java.sql.Timestamp(System.currentTimeMillis()).getTime()
    
    Result : 1539594988651
    

    Hope this will help. Just my suggestion and not for reward points.

提交回复
热议问题