How to add 14 days from the day when it was created
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 10:42 PM
How to add 14 days to one of the date field from when it was created in scoped app.
var gd = new GlideDateTime();
gd.addDaysLocalTime(14);
gd.setDateNumericValue(gd.getNumericValue());
Its adding 14 days but when the record created after 8 PM time . its adding 15 days.
can someone please help me in adding exactly 14 days from the date when it is created
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 10:50 PM
Hi,
Please try below
var gd = new GlideDateTime();
gd.addDays(14);
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 11:01 PM
I tried but addDays() wont support in scoped app.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 11:03 PM
Hi,
I think addDaysUTC() should work.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 10:56 PM
please use addDaysUTC()
in which field you are setting the value?
var gd = new GlideDateTime();
gd.addDaysUTC(14);
gd.setDateNumericValue(gd.getNumericValue());
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader