The CreatorCon Call for Content is officially open! Get started here.

convert date to DD/MM/YYYY format servicenow portal

Amol J
Kilo Contributor

find_real_file.pngI want this date in DD/MM/YYYY format to show on portal

1 ACCEPTED SOLUTION

asifnoor
Kilo Patron

Hello Amol,

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.

View solution in original post

7 REPLIES 7

Omkar Mone
Mega Sage

Hi 

There is a system property named glide.sys.date_format which deals with the format of date that should be shown on the instance. If you change it to your format that will be applied everywhere globally. 

find_real_file.png

 

Hope this helps.

 

Regards

Omkar Mone

Also, check this link for additional information - 

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/administer/time/reference/r_DateF...

 

Regards

Omkar Mone

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Could you clarify your question a bit? Where/when do you want to do this? Is this on a widget? On a Catalog Item presented? Is this onChange retrieving some values? Etc..

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

asifnoor
Kilo Patron

Hello Amol,

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.