Show date/time field as just a date on a notification

Dan Brown2
Kilo Sage

I am trying to show a date/time field from a form in just date format on the notification, currently it shows as below:

 

DanBrown2_0-1751466556365.png

I have tried a few community posts that advise using a mail script, but I can't get that to work.  

Can anyone help?

Dan

2 REPLIES 2

J Siva
Tera Sage

Hi @Dan Brown2 

Have you tried the below script in your mail script?

var date_time ="22-02-2025 00:00 IST";
var date =date_time.split(" ")[0];
template.print("<p>"+date+"</p>");

Regards ,

Suva

SanjanaK
Tera Expert

Hey @Dan Brown2 ,

You can try below code:

var dateTime = '22-09-2022 00:00 BST';  // your date time field
var dateTimeField = new GlideDateTime(dateTime);
template.print("<p>" + dateTimeField.getDate() + "</p>");     
 
******************************************************************************************************
Hope the answer helps!
Happy Learning!