- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2020 01:42 PM
hello we are on Newyork.
I have a need to convert default time format YYYY-MM-DD HH:MM:SS in Servicenow to YYYY-MM-DD HH:MM format. (Excluding Seconds), because the tool, we are sending this accepts only YYYY-MM-DD HH:MM format.
How can I do that? The final value should be of Date time only.
So 2020-02-20 23:09:18 should return 2020-02-20 23:09
Please advise.
Thanks,
Rajan
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 09:28 AM
JSON always send date as a string. Which would make jacebeson's post below make sense that the API is looking for an integer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 06:14 PM
Finally I was able to get going. The issue I found out was when getting display value format is changed to
02-20-2020 23:09:18 and I needed YYYY-MM-DD HH:MM so it was getting rejected.
Thank you very much all of you for helping me out resolve the issue.
Thanks,
Rajan Mehta

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 09:11 AM
Not sure what endpoint you're using in Dynatrace, but it appears it takes an integer not date/time for the start time. https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/events/post-ev...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2020 11:19 PM
GlideDate and the function getByFormat will convert from one format to another.
https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=c_GlideDateScopedAPI.dita
var gd = new GlideDate();
gd.setValue('2015-01-01');
gs.info(gd.getByFormat("dd-MM-yyyy"));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 07:45 AM
Hello Rich
Thanks for your tips. I am following it and can you please advise, what do I need to change here?
When I execute this I am getting following results.
I should get (or rather expecting) below.
2020-02-21 07:09:18 ==> get converted to 2020-02-21 07:09 (Date format not String)