
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 01:40 AM
How to convert date time like this "20030228032647.0Z " into MM-dd-yyyy hh:mm:ss ?
This date time is being fed through Active Directory integration with ServiceNow and I'd like to process this date time in the Transform Map itself.
Any help would be appreciated!
Thanks in Advance.
Solved! Go to Solution.
- Labels:
-
Enterprise Asset Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 02:05 AM
Hello,
try below code:
var s = "20030228032647";
var v = s.substring(0, 4) + '-' + s.substring(4, 6) + '-' + s.substring(6, 😎 + " " + s.substring(8,10) + ":" + s.substring(10,12) + ":" + s.substring(12,14);
gs.print(v)
it worked for me. Output:
*** Script: 2003-02-28 03:26:47
source: https://stackoverflow.com/questions/10631483/specific-date-format-from-date-string-in-java
Please mark correct/helpful if applicable.
Thanks,
Ali
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 02:05 AM
Hello,
try below code:
var s = "20030228032647";
var v = s.substring(0, 4) + '-' + s.substring(4, 6) + '-' + s.substring(6, 😎 + " " + s.substring(8,10) + ":" + s.substring(10,12) + ":" + s.substring(12,14);
gs.print(v)
it worked for me. Output:
*** Script: 2003-02-28 03:26:47
source: https://stackoverflow.com/questions/10631483/specific-date-format-from-date-string-in-java
Please mark correct/helpful if applicable.
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 02:20 AM
Or you can use:
var d = '20030228032647.0Z';
var gdt = new GlideDateTime();
gdt.setValueUTC(d, 'yyyyMMddHHmmss');
gs.print(gdt.getValue() + ' - ' + gdt.getDisplayValue());
Value is server formated value and displayValue is locally formated incl local timezone