You need to sign in to do that
Don't have an account?
Mahesh Babu 3
Subtraction for two datetime fields
Hi All,
I am trying to subtract two datetime fields but i got below error message,
" Date/time arithmetic expressions must use Integer, Decimal or Double arguments "
My code is in below
CronTrigger ct = [SELECT Id,NextFireTime,starttime, CronJobDetail.name FROM CronTrigger where CronJobDetail.name = 'samplejob001' limit 1];
integer temp = ct.NextFireTime - ct.starttime;
System.debug('=====>'+temp);
Please guide me, how to solve this issue.
I am trying to subtract two datetime fields but i got below error message,
" Date/time arithmetic expressions must use Integer, Decimal or Double arguments "
My code is in below
CronTrigger ct = [SELECT Id,NextFireTime,starttime, CronJobDetail.name FROM CronTrigger where CronJobDetail.name = 'samplejob001' limit 1];
integer temp = ct.NextFireTime - ct.starttime;
System.debug('=====>'+temp);
Please guide me, how to solve this issue.
In that case you can use the following code. This returns the number of hours of difference between the dates.
Thanks
AR
If you find the reply useful that solved your problem then mark it as best answer.
All Answers
Use the following code instead. This will work.
Thanks
AR
If you find the reply useful that solved your problem then mark it as best answer.
I want to get this in hours format not in days, actual results will be lessthan 24 hours
In that case you can use the following code. This returns the number of hours of difference between the dates.
Thanks
AR
If you find the reply useful that solved your problem then mark it as best answer.