- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2021 06:56 AM
I'm importing data from JDBC and getting date error:
"Unable to format 20,210,526 using format string yyyy-MM-dd for field due_by (Date Time field) "
In field map the date format I set:
Please help how to resolve this. Thanks.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2021 01:15 PM
That's different. In which case, I would eliminate the commas and format accordingly. Here is proof that you can run in Scripts - Background:
var oString = '20,210,526';
var nString = oString.replace(/,/g, "");
gs.info(nString);
var yyyy = nString.slice(0,4);
var mm = nString.slice(4,6);
var dd = nString.slice(6,8);
gs.info(yyyy);
gs.info(mm);
gs.info(dd);
var gd = new GlideDate();
gd.setDate(yyyy + '-' + mm + '-' + dd);
gs.info(gd);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2021 07:41 AM
Here's the exact script I used in transform map script. Thanks for the help
var oString = source.duedate;
var nString = oString.replace(/,/g,"");
var yyyy = nString.slice(0,4);
var mm = nString.slice(4,6);
var dd = nString.slice(6,8);
var gd = new GlideDate();
gd.setValue(yyyy + '-' + mm + '-' + dd);
target.due_date = gd.getDisplayValue();