In what type of java variable do I store a TIME value of Mysql?

0

I have data of TIME type in my database and I would like to bring these to a variable in java that allows me to do operations (sum of times, compare who is older). I have tried to use variable of type java.sql.Time but it does not get assigned;

    
asked by Deyvi De La Cruz 14.03.2018 в 22:57
source

1 answer

0

You can use the DateFormat class to set the time, this allows you to handle the date easily, and get hours, minutes and seconds with which you can perform the operations you want.

   DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
   Date date = new Date();
   System.out.println(dateFormat.format(date));
    
answered by 17.03.2018 в 15:48