how to add duration field to today date and time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 10:25 PM
i have duration field i am geeting 5days 2hr 50min 20 sec i want to add this duration to gs.nowdateandtime()./finall i want todaydate +5days 2hr 50min 20 sec,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 10:35 PM
You can use
addSecondsLocalTime
and
addDaysLocalTime function. Follow the below link and let me know if this helps
http://wiki.servicenow.com/index.php?title=Modify_a_GlideDateTime_Field_Value#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 11:25 PM
i am saying 5days 2hr 50min 20 sec all this add at a tiime if you query the duartion type field you can get like this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 01:05 AM
Ok, so suppose you are trying to add Business Duration (of type duration) to now date time:
var gr = new GlideRecord('incident')
gr.addQuery('number','INC0000027');
gr.query();
if(gr.next())
{
var x=new GlideDateTime();
var y = (gr.business_duration.getGlideObject().getNumericValue())/1000;
x.addSeconds(y);
}
x is nowDateTime and y is the result i.e. addition of x and business duration.
Let me know if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2017 01:53 AM
Hi Anurag,
i am working on catalog item here delivery time(duration type) field is available see below i am getting 5days 12 hrs 30 min 45 sec,here i ant to to add this entire duration to todatdate and time finally i want to get suppose (today +delivery time) =21/02/2017 12:30:45 like that