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

The Solution to How to get current timestamp in string format in Java? "yyyy.MM.dd.HH.mm.ss" is


Replace

new Timestamp();

with

new java.util.Date()

because there is no default constructor for Timestamp, or you can do it with the method:

new Timestamp(System.currentTimeMillis());

~ Answered on 2014-04-14 19:33:18


Most Viewed Questions: