How to convert Date Time field value to ISO format value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 12:55 AM
I have written below script on the "sn_customerservice_case" table to convert date time field value to ISO format.
var updated = current.getDisplayValue('sys_updated_on');
var dt = updated.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]);
gs.log("sanjay event " + event);
var isoDate = event.toISOString();
In the log it is giving the result as "sanjay event Invalid Date". Please help to provide the solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 01:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 01:54 AM
Hi,
I have followed the same steps and after following the same steps I am facing the issue. In the event variable step I am getting "invalid date" value in the logs. Help me on this issue, why I am gating invalid date in event variable step

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2022 03:23 AM
Hi,
Code looks fine check if correct value & format is being populated in variable "updated'.
Regards,
Akshay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2022 09:22 PM
Hi,
Till var "t", I am getting the values but for the var "event" only I am getting the value as Invalid date.
Regards,
Sanjay