How to set Catalog item variable date/time to display short date/time?

Nicholas Hromya
Mega Guru

I want the Catalog Item variable of date/time (could be single line text) in the service portal to NOT show seconds or  milliseconds.

 

I understand this can be set on the display for user preferences, however, two things, it is already set to not show seconds and I have found this is not applying it to the catalog item within the service portal and not in the notifications when it displays this variable.

 

I was looking at something like the below, but I don't see how I can apply this to the variable type date/time.

 

var gd = new GlideDate();

var displayValue = gd.getDisplayValue();

gs.info('Display Value: ' + displayValue); // Output: Display Value: 11-13-2023

 

or can I add this to my notification?

=FormatDateTime(variablename, DateFormat.ShortDate)

 

Thanks in advance.

Nick

7 REPLIES 7

Hello @swathisarang98 

Yes, I do not want a Global change.

Thanks

Nick

Hello @swathisarang98 

I will try this.

Thanks!

Hello @SwathiSarang 

Thank you for the reply, I got a java script error on the catalog item.

I want to include the catalog item view.

I really want this to apply to a Notification, I presume the variable with seconds at 00 will pass through.