- 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-07-2020 02:40 PM
I'm writing this like it is in a business rule but you can convert it to what ever type of script your are using.
var dateStr = current.getDisplayValue('field name').toString();
var res = str.slice(0, 16);
Then you would send res variable but of course you can change that to something more meaningful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2020 04:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 07:51 AM
Hello Knight,
I get your point. Only issue is the new value returned is String and I have to send the data in date format. (YYYY-MM-DD HH:MM). Also if I convert back from String to Date it goes into YYYY-MM-DD HH:MM:SS format.
so if you can guide me how do I correct this, that would be great.
Thanks,
Rajan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2020 08:48 AM
What is your method for sending the data to the other system?