java - convert string to seconds -
If my hour time is more than 24 hours, how can I convert string time in seconds? My time table comes from column
Ex:
column name (late): time (string): 00:40:00
conversion: < / P>
New SimpleDateFormat ("hh: mm: ss"). Parse ($ F {late}) GetHours () * 3600+ new Simple Format ("hh: mm: ss"). Parse ($ F {late}) getMinutes () * 60+ new simpleformformat ("hh: mm: ss"). Pars ($ F {late}}. GetSeconds (); Output: 2400
The results above are true, but the value of my field results: 31:58: 00, then my above expression is not working.
Output is: 28680
28680 remaining (115080-86400)
But in fact the output ' 115080.
I recommend that you do this at the time of day (i.e. 31:58:00 - 24:00:00), then calculate both and sum up.
Comments
Post a Comment