Date time error while importing

Pavan S
Tera Contributor

Hi.

 

Iam using transform map for importing the holidays list (from excel) into ServiceNow.

But while importing the start date timing is getting changed to 18:30:00 instead of 00:00:00.

 

The start date time iam importing from excel 

PavanS_0-1765796285742.png

The date it is updating in ServiceNow 

PavanS_1-1765796323478.png

i have tried the onBefore and onAfter scripts but still it didn't work. Also tried to change my Time zone or excel time zone but still it didn't work.

 

Can anyone help me about how to update the exact time mentioned in the excel sheet. (i have done the same thing from past 3 years bit it worked. Now only facing the issue)

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Pavan S 

try this in onBefore transform script and try to set display value

target.setDisplayValue('start_date_time', source.u_start_date_time);

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, 

 

I have tried the above on Before script already, but it didn't work😐

@Pavan S 

excel data is in GMT or which timezone?

what's your timezone when seeing the records?

Did you check in XML of that record?

If you are getting GMT and set GMT then it should be fine

target.setValue('start_date_time', source.u_start_date_time);

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Pavan S 

I tested and it worked fine for me

I considered the date/time in Excel is in GMT and used the script I shared and it showed the correct value when I selected timezone as GMT in Preferences

In staging table the date came as string

AnkurBawiskar_1-1765803543333.png

In target it was populated exact

AnkurBawiskar_0-1765803507001.png

Note: you should always know the date/time in excel/csv is in which timezone, so that you can handle that in your transform script, always set value in GMT

if you got to know the date/time in excel is in Sydney then convert that to GMT and use setValue() to set value in GMT

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader