Show date/time field as just a date on a notification
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 07:31 AM
I am trying to show a date/time field from a form in just date format on the notification, currently it shows as below:
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 08:25 AM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 09:04 AM
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!