Unable to convert date format to DD-MM-YYYY

sainath3
Mega Guru

Hi All,

 

In my User profile changed the date format to dd-MM-yyyy.

 

am loading the data thr transform, in source table for the start date field  i have taken as string.

in Source table date is 19-03-2025.

Am just mapping to the target field, but in target field it showing as "14-09-0024".

If I try with new GlideDateTime() it is returning as "2025-03-19"

Don't know how it has changed.

 

but I want date should be same as Source table date "19-03-2025"

Can you please help me.

2 ACCEPTED SOLUTIONS

Shree_G
Mega Sage

Hello @sainath3 ,

 

You can use below code to ensure the format.

var new gdt = new GlideDate();

gdt.getByFormat("dd-MM-yyyy");

 


If this solution helped resolve your issue, please consider marking it as helpful or correct.
This will assist others in finding the solution faster and close the thread.

View solution in original post

@sainath3 

see the date will be set properly in target field

But the date it will display is based on your date format in sys_user or in preferences

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

5 REPLIES 5

Hi Shree,

I tried the same but no user, still same wrong format