How to Change the date format to DD-MM-YYYY

Shweta Kasbe1
Tera Contributor

Need to change the date format to DD-MM-YYYY.

I am having one variable Leave date in that there is by default  YYYY-MM-DD.Need to change it to DD-MM-YYYY

Please find below ss and guide me in this.

find_real_file.png

3 REPLIES 3

Chandu Telu
Tera Guru
Tera Guru

Hi Shweta,

 

OOTB system have one date format and you can't change that format to each field. Check the below it will help you

 

https://community.servicenow.com/community?id=community_question&sys_id=b197496fdb5a5854d5c4d9d968961988

 

Thanks
Chandu Telu
Please Mark āœ… Correct/helpful, if applicable,

Alok Gupta5
Tera Guru
Tera Guru

Hello ,

 

You can change to required format.

Please see the below article about this.

https://docs.servicenow.com/bundle/sandiego-it-operations-management/page/product/discovery/concept/cert-inventory-mgmt.html

 

Regards,

Alok Gupta

Vaishnavi Lathk
Mega Sage
Mega Sage

Hello ,

If you want to get the date in this format (dd/mm/yyyy) to show on SP, then return the date from the backend like this

var gdt = new GlideDateTime("2019-11-14 12:33:50");
var myDate = gtd.getDate();

var gd = new GlideDate(); 
gd.setValue(myDate);
gs.info(gd.getByFormat("dd-MM-yyyy"));

Mark the comment as a correct answer and helpful once worked.

Regards.

Vaishnavi Lathkar