- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2015 12:46 AM
Hi All,
I have two Date/Time field in service catalog form.
1. start date/time
2.End date/time
I want to set start date as current date and time. I have achieved this using javascript:gs.nowDateTime();
for end date/time field , I want the value as start date/time + 36 Hours.
How can I achieve this , Please guide me on this.
Appreciate every Comment on this post.:)
Thanks & Regards
Govind Kumar Sharma
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2015 10:53 PM
Hi All ,
Thanks for reply .
I got solution for this requirement. Client Script Date/Time Functions .
function onLoad() {
var cdt = g_form.getValue('startdate'); //Choose the field to add time from
var addtime = 36; //The amount of time to add
var addtype = 'hour'; //The time type. Can be second, minute, hour, day, week, month, year.
var ajax = new GlideAjax('ClientDateTimeUtils');
ajax.addParam('sysparm_name', 'addDateTimeAmount');
ajax.addParam('sysparm_fdt', cdt);
ajax.addParam('sysparm_addtime', addtime);
ajax.addParam('sysparm_addtype', addtype);
ajax.getXML(doSomething);
function doSomething(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
//You could then take the new Date/Time answer and set the value of another field.
// g_form.setValue('expected_start', answer);
//g_form.enddate.setDisplayValue(answer);
alert("enddate :" +answer);
g_form.setValue('enddate', answer);
}
}
Thanks & Regards
Govind Kumar Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2015 01:44 AM
hoursago will use system time and not user time? Correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2015 02:24 AM
Hi Kalai,
You are right. it is using system time.
When I am changing time zone, Start date/time field is changing accordingly but End Data/time is not changing.
Thanks & Regards
Govind Kumar Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2015 02:26 AM
Hi Neetu,
It is using System time. when I am changing time zone end date/time field is not changing accordingly.
Thanks & Regards
Govind Kumar Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2015 10:53 PM
Hi All ,
Thanks for reply .
I got solution for this requirement. Client Script Date/Time Functions .
function onLoad() {
var cdt = g_form.getValue('startdate'); //Choose the field to add time from
var addtime = 36; //The amount of time to add
var addtype = 'hour'; //The time type. Can be second, minute, hour, day, week, month, year.
var ajax = new GlideAjax('ClientDateTimeUtils');
ajax.addParam('sysparm_name', 'addDateTimeAmount');
ajax.addParam('sysparm_fdt', cdt);
ajax.addParam('sysparm_addtime', addtime);
ajax.addParam('sysparm_addtype', addtype);
ajax.getXML(doSomething);
function doSomething(response){
var answer = response.responseXML.documentElement.getAttribute("answer");
//You could then take the new Date/Time answer and set the value of another field.
// g_form.setValue('expected_start', answer);
//g_form.enddate.setDisplayValue(answer);
alert("enddate :" +answer);
g_form.setValue('enddate', answer);
}
}
Thanks & Regards
Govind Kumar Sharma