- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 10:44 PM
Hi Guys,
My problem is: I want to subtract two date/Time field and the result should stored in another field.
This i have achieved through this code using Business Rule.
"var gdt1 = new GlideDateTime(current.initial_response_date_time.getDisplayValue());
var gdt2 = new GlideDateTime(current.open_date_time.getDisplayValue());
var dur = GlideDateTime.subtract(gdt2, gdt1); //the difference between gdt1 and gdt2
var dur1= new GlideDuration();
dur1.setValue(dur.getValue());
current.si_actual_response_duration=dur1.getDurationValue(); "
But the problem is i need to convert this duration field to seconds and this has to be stored in another field.
And also i have one more problem with this script is, the result gives me the duration along with date like this. "1970-01-01 01:00:00"
Can someone help me to resolve this issue?.
My Need is: Two date and time field has to be subtracted and the result should stored in another field as seconds.
Thanks in advance for the help.
Malaisamy J
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 10:51 PM
the result you need to store in another field if that is a date/time field then 1970-01-01 01:00:00 is a valid value to store 1 hour.
what's the type of field?
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 10:51 PM
the result you need to store in another field if that is a date/time field then 1970-01-01 01:00:00 is a valid value to store 1 hour.
what's the type of field?
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 10:55 PM
Thanks for the response.
Its a duration field.. But i want the result in seconds and that should be stored in string field. Is it possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 11:00 PM
here to set max unit
try setting dictionary attribute of field to:
max_unit=seconds
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2016 01:18 AM
Do i need to change the result field as string or it can be of duration field ?
Because i made the result field as string and checked its not working.
Help me on this.
Thanks,
Malaisamy