- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 11:14 PM
Hi Team,
We have integration with third party tool, where I have to Send Time Range From- to in body.
In from time I have to send Current Date Time in ISO ISO8601 format: yyyy-MM-dd'T'HH:mm:ss'Z then
I have subtract 10 minutes into current date time and have to pass in "to"
How can we achieve it?
Please Help me here
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 11:19 PM
Hi,
So you want to subtract 10mins and then convert to ISO?
if yes then do this
var gdt = new GlideDateTime('your date time');
gdt.addSeconds(-600); // 10 mins is 600 seconds
var dt = gdt.getValue().split(' ');
var f = dt[0].split('-');
var t = dt[1].split(':');
var event = new Date(f[0], f[1]-1, f[2], t[0], t[1], t[2]);
var isoDate = event.toISOString();
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
07-09-2024 08:18 AM
Hi Lucky,
according to error message, you need to chomp off the trailing three digits after the seconds (format says ss"Z" you are passing ss.000"Z").
HTH
- Patrick