- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2022 01:51 AM
I know the start time and the duration(they are all Time types),How to add them together or How can I get the end time?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2022 02:21 AM
Set the fields as per your field name
var start_date = new GlideDateTime(current.u_start_date.getDisplayValue());
var end_date = current.u_duration.dateNumericValue();
start_date.add(end_date);
current.u_end_date = start_date.getValue();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2022 02:02 AM
Hello
Try below code, use dateNumericValue() function which will convert duration back to seconds and will set it back to duration after adding another duration.
var dur = new DurationCalculator();
dur =gr.duration.dateNumericValue() + gr.duration.dateNumericValue();
gr.duration.setDateNumericValue(dur);
Please Mark ✅ Correct/helpful, if applicable, Thanks!!
Regards
Sulabh Garg
Regards
Sulabh Garg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2022 02:21 AM
Set the fields as per your field name
var start_date = new GlideDateTime(current.u_start_date.getDisplayValue());
var end_date = current.u_duration.dateNumericValue();
start_date.add(end_date);
current.u_end_date = start_date.getValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2022 04:05 AM
Do you want to add 2 fields ( one is date/time and another is of Duration type) ?
I tried adding 2 fields of type Time and cannot get the desired output