Ben Vargas
Tera Guru

I ran into this question as well... you can use the GlideDate Object with time values and then the getByFormat() method to get the format you need.

Here is a script that can be run in Scripts - Background to validate this:

var incidentGR = new GlideRecord('incident');
incidentGR.get('some_valid_incident_sys_id_here');

gs.log('updated: ' + incidentGR.sys_updated_on);

var gd = new GlideDate();
gd.setValue(incidentGR.getValue('sys_updated_on'));
gs.log('updated ISO: ' + gd.getByFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));

Example output:

[0:00:00.196] Script completed in scope global: script


Script execution history and recovery available here


*** Script: updated: 2021-07-26 22:23:58
*** Script: updated ISO: 2021-07-26T22:23:58.000+0000