Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

facing issue in Date format while importing the csv file

divs
Kilo Contributor

whenever i am changing the date format (customized) according to Glide date time (yyyy-mm-dd hh:mm:ss) in csv...it is not saving the format.How can i accomplish that?

23 REPLIES 23

divs
Kilo Contributor

i tried but i am getting error Unable to format 1/15/2018   8:53:00 PM using format yyyy-mm-dd hh:mm:ss


The format is 1/15/2018   8:53:00 PM   in my export sheet.


I think i need to write script for that.


Am i correct?


can anyone have that script?


divs
Kilo Contributor

date time format.png



I dont have that format here.how can i set it?


You can write whatever format you want in the date format field, just type in dd/MM/yyyy HH:mm:ss



If that doesn't work you could try using the below script but i've not tested it so i can't say if it'll work or not. Your best bet would be to amend the source data to match your instance address though.



var date = source.u_incident_occurred;


var dateFormat = 'dd/MM/yyyy HH:mm:ss a'


var gdt = new GlideDateTime();


gdt.setDisplayValue(date, dateFormat);


target.u_incident_occurred = gdt.getDisplayValue();


Hi Divya,



I already told you, to achieve this we have to write script.



We have to convert it to format of the system or current datetime format you are using.



Thanks,