Skip to main content

Posts

Showing posts from July, 2010

Easiest way to print Timestamp in Java

Rather than using Calendar.getTime() we can use java.sql.Timestamp class to get the time stamp which gives date and time till millisecond precision. System.out.println(new Timestamp(System.currentTimeMillis())); Above will give you current timestamp in this format: 2010-07-27 16:37:45.39