I have a class called Lezione that has an attribute time of type Time. This attributes is filled with the value of the attribute time of the table Lezione in my database (mysql). Also, the attribute time in the database is of type TIME.
Now: I do a query on the db:
select * from lezione as l
and then I create an object of type Lezione and I set all the attributes. For the time I do this:
l.settime(rs2.getTime(3));
And this Works.
When I try to print the value with l.gettime() I get the value (f.e.) 13:00:00
What I would like to have instead is 13:00
I tried with the expression
l.gettime().getHours()+":"+l.gettime().getMinutes()
(that uses depreciated methods) but it prints 13:0 (and I guess that if I would like to print 09:02 it would print 9:2)
So What can I do?
Use a simpledate formatter.