Sunday, November 29, 2015

How to get current timestamp in java - Obtener Timestamp tiempo actual en JAVA

La forma de convertir la fecha actual a timestamp es la siguiente


 Date date= new Date();
         //getTime() returns current time in milliseconds
  long time = date.getTime();
         //Passed the milliseconds to constructor of Timestamp class 
  Timestamp ts = new Timestamp(time);
  System.out.println("Current Time Stamp: "+ts);

No comments:

Post a Comment