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

Amol J
Kilo Contributor

thanks it worked

Great. Could you also mark the comment as a correct answer so that the question is moved to the solved list.

Krishna  Penaka
Tera Expert

var gdt = new GlideDateTime("2019-11-14 12:00:00");

gdt.setDisplayValue("14-11-2019 12:00:00",

"dd-MM-yyyy HH:mm:ss"); //uses current user session time zone (US/Pacific)

gs.print(gdt.getValue());