- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 04:44 AM
How to add the duration field(days and hours) to the date time field dynamically and store the result in date time format?
eg.
sla time = 5 days 1 hour
due date = current time(2023-11-28 08:10:50) + sla time
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 05:01 AM
Hello @KARTIK17
You need to write a Script for this :-
var sla = current.sla_time;
var datetime =sla.split(" ");
var date = datetime[0];
var time = datetime[2];
var gdt = new GlideDateTime(gs.nowDateTime());
gdt.addDays(date);
gdt.addSeconds(3600*time);
current.due_date=gdt;
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2023 06:52 AM - edited 11-29-2023 06:52 AM
Hello @KARTIK17
The reason behind is you wrote:-
gbt.seconds, It should be gbt.addSeconds(ts);
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh