开发者

Compare two times

开发者 https://www.devze.com 2023-01-04 12:55 出处:网络
i want to compare between two times the first one is getting by the resultset of an sql query like the following:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消