Compare two times
i want to compare between two times the first one is getting by the resultset
of an sql query like the following:
res = req.executeQuery("SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(timespent))) FROM dailytimesheet where trackingdate=CURRENT_DATE and matricule=36;");
res.first();
{
retour.append("<td><label style=\"background-color:#09F\" style=\"font:Verdana, Geneva, sans-serif\" style=\"font-size:16px\"> Total Hours</label><td>"+res.getString(1)+ "</td>");
and the second time is: 07:30:00
so i want to display a message if the time containing in the res.getS开发者_运维技巧tring(1)
is bellow the time 07:30:00
.
i dont know how to achieve the comparison.
you would have to create a Date/Time from the string and then diff it with a Date/Time of 07:30:00
in java: date.compareTo(otherdate) will return -1 if smaller, 0 if equal, +1 if higher
精彩评论