converting string to GlideDateTime

steved
Kilo Explorer

Hi - hopefully someone has encountered this before and can get me over the last hurdle. I am importing records from excel into SN using a transform map. A few fields are date fields or which i have made strings - then during the transform i convert to glidedateTime. The transform reports ignored errors and the dates populate in the target but the HHMMSS do not convert but default to midnight. I need to keep as date time and in dd-mmm-yyyy hh:mm:ss format. My transform script is onBefore:

var gdt = new GlideDateTime();

gdt = source.uclosed;

target.u_closed = get + get.addDays(+1);

I have to add one day to match the source date.

Any help is appreciated.

7 REPLIES 7

in the end it in fact came down to formatting not scripting. the date format that worked was MM/dd/yyyy H:mm



Thanks both of you for your suggestions!


No worries


Please mark anything that was useful as 'helpful'


Feedback is important



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

@Paul can you please have a look at this question Parse Apr-01-2016 11:11:58 PM to yyyy-MM-dd hh:mm:ss format.