user3703289 user3703289 - 1 year ago 125
Java Question

Convert timestamp to string

In java I need to display 'time of the program start'

It must be in


How do I get the current time, and then convert it to a

Answer Source

try this

SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
String string  = dateFormat.format(new Date());

you can create any format see this

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download