- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2017 10:25 AM
Hi All,
I have a client script that processes and create a new change with many field completed.
I also need to add start and end date on certain conditions.
Start date is no problem using gs.nowDateTime();
grCH.start_date = gs.nowDateTime();
For the end date, all I need to do is add 30 min to the date/time that is set in start_date but I cannot figure out how to do this.
grCH.end_date ??
Any suggestions greatly welcome.
Thanks,
Ellie
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2017 10:32 AM
This is how we do it in a Default value of the field:
javascript: getDateTime();
function getDateTime() {
var dateTime = new GlideDateTime();
dateTime.addSeconds(1800);
return dateTime.getDisplayValue();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2017 10:32 AM
This is how we do it in a Default value of the field:
javascript: getDateTime();
function getDateTime() {
var dateTime = new GlideDateTime();
dateTime.addSeconds(1800);
return dateTime.getDisplayValue();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2017 10:40 AM
Thanks Mike,
I have been able to convert it and use in my script include.
Regards,
Ellie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2017 10:40 AM
Will be in GMT, but this is one approach:
gs.minutesAgo(-30)
Check out the GlideSystem API documentation: https://developer.servicenow.com/app.do#!/api_doc?v=helsinki&id=c_GlideSystemAPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2022 05:26 AM
javascript:var DT = new GlideDateTime(); DT.addSeconds(1800); DT.getDisplayValue();
Hit like if helpful