how to convert the date time to the format yyyy-MM-ddTHH:mm:ss ±hh:mm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2021 05:18 AM
Hi All,
I have a requirement to send date time values in specific format in SOAP request. I want to convert the date time field value to the format yyyy-MM-ddTHH:mm:ss ±hh:mm. Please help with your suggestions. Thanks in advance!
Regards,
Thilagavathy S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2021 05:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2021 05:41 AM
Hi,
you will have to convert your date/time to ISO format
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
01-07-2021 05:43 AM
Hi,
You can use this line of code to convert the time to ISO format
var myDate = new Date();
var isoDateTime = myDate.toISOString();
gs.info(isoDateTime);
Output:
[0:00:00.038] Script completed in scope global: script
Script execution history and recovery available here
*** Script: 2021-01-07T13:43:38.090Z
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader