Need to know how does addDays() work in script include ? I have already fetched today's date via script include,need to alter this date by 5 days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 10:44 AM
Need to know how does addDays() work in script include ? I have already fetched today's date via script include, need to alter this date by 5 days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2014 11:04 AM
Please look at the link: it shows you how to add days/hours and etc to server side scripts. The second link may also be helpful.
Modify a GlideDateTime Field Value - ServiceNow Wiki
GlideDateTime - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 02:31 AM
var gdt = new GlideDateTime();
gdt.addDays(5);
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 02:07 AM
It's not work....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2014 02:40 AM
HI Kushagra,
I am guessing you used a query to fetch the date to be modified, assuming the object name is gr and field name is start_date, this is how you can use addDays method:-
var gdt = new GlideDateTime(gr.start_date);
gdt.addDays(5);
Thanks & Regards,
Hari