To get time from glide date time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2017 05:24 AM
I am not getting the time field from the below code as i have to set it to 08:00:00 how should i do it. next day date i am getting properly how to get the time.And then return the complete date and set the field in client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2017 05:34 AM
Hi Bhagyashree,
Can you explain your requirement in details
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2017 05:41 AM
In planned start date of project form I have to populate a date on on load where the date is the next date like if today is 22 it should be 23.and the time should be set as "08:00:00"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2017 05:55 AM
Hi Bhagyashree,
In your script include function have following script:
var gdt = new GlideDateTime();
gdt.addDaysUTC(1);
return gdt.getDate();
then in client script add 08:00:00 to the answer which you get from GlideAjax
g_form.setValue('closed_date', answer + "08:00:00");
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2017 05:42 AM
Here is an example:
var myDate = new GlideDateTime();
var myarr = String(myDate.getDisplayValueInternal().toString());
myarr = myarr.split(' ');
for (var i = 0; i < myarr.length; i++) {
gs.print(myarr[i]);
}
In background scripts:
[0:00:00.003] Script completed in scope global: script
*** Script: 2017-06-22
*** Script: 05:42:00