How to add HOURS:MINUTES:SECONDS value on DateTime field?
On example I want in my field which contains dimetime value to add (sum) with string value which contains value in HH:MM:SECONDS.
ReportDate is 2013-01-01 10:00:00
Value to add is :120:34:29
So result should be: 2013-01-06 10:34:00
I tried with:
GregorianCalendar c = new GregorianCalendar();
c.setTime(reportDate);
String toAdd='120:34:29';
c.add(Calendar.HOUR, toAdd);
java.util.Date targetFinish = c.getTime();
SystemOutPrintln(targetFinish.toString());
So problematic row is c.add(Calendar.HOUR, toAdd);
How to add these value? I want to do it over Gregorian Calendar. And want to have in SysOut that new value;
Thank you
You can parse text into hours, minutes and seconds and add them like -