- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 10:53 AM
Hello all,
I have a script include which gets me tomorrow's date. However it sends it back to my client script in the wrong format.
I tried using getByFormat("YYYY-MMM-DD HH:MM:SS") on the GDT variable, however this functionality is not available on KINGSTON. Not sure how to proceed...
Thanks
Pranav
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 11:00 AM
Hi ,
It seems that this function is still available on Kingston and I tried in my PDI to test it. Can you post the entire script as to how are you using that function ?
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_ScopedGlideDateGetByFormat_String
var gd = new GlideDate();
gd.setValue('2015-01-01');
gs.info(gd.getByFormat("dd-MMM-yyyy HH:MM:SS"));
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 11:00 AM
Hi ,
It seems that this function is still available on Kingston and I tried in my PDI to test it. Can you post the entire script as to how are you using that function ?
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_ScopedGlideDateGetByFormat_String
var gd = new GlideDate();
gd.setValue('2015-01-01');
gs.info(gd.getByFormat("dd-MMM-yyyy HH:MM:SS"));
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 11:51 AM
Hey Abhishek,
This was correct, getByFormat only works on glideDate and glideTime.
Another followup, if I have a glideDate and a glideTime, how can I make a new GlideDateTime??
I tried doing getDisplayValue for both but it returns null weirdly..
thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 11:59 AM
Hey ,
Glad you were able to figure it out. I am not sure what you meant by your follow up question ?
var gDate = new GlideDate(); gDate.setValue('2015-01-01'); gs.info(gDate); var gDT = new GlideDateTime(gDate); gs.info(gDT);
You can do something like this. NEver heard of GlideTime though.
Please mark this answer as correct/helpful if this solves your problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2019 12:03 PM
GlideTime is the same as GlideDate but for time.
Okay regardless, lets say I have a glideDate. How can I make a GlideDateTime with this date without manually inputting a value?
Thanks