- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 07:44 AM
Hi,
I have a date field in the form (date_birth) which is in YYYY/MM/DD format.
I want this to be changed to DD/MM/YYY format in an email notification.
Can someone please help me with the mail script. One I created doesn't render the desired result.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 10:53 AM
@Thomas99 Here is my testing result, i have tested on my personal instance.
Attached screenshot for your reference, it working perfectly at my end.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 08:15 AM
Hi @Thomas99 You can try to use below script.
var dt = "2024/01/12"; // Change here with your field name
var gdt1 = new GlideDate();
gdt1.setDisplayValue(dt);
var fDate = gdt1.getByFormat("dd/MM/yyyy");
gs.print(fDate); // Use template.print to print it on notification
Hope it will help you.
Thanks,
Harsh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 08:18 AM
Mail script sample code .
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var gdt1 = new GlideDate();
gdt1.setDisplayValue(current.<FieldName>); // Add your field Name
var fDate = gdt1.getByFormat("dd/MM/yyyy");
template.print(fDate);
})(current, template, email, email_action, event);
Thanks,
Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 10:40 AM
Hi Harsh,
I used the mail script you provided and replaced the field name, however, I'm getting today's date than the actual date that is entered in the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2024 10:53 AM
@Thomas99 Here is my testing result, i have tested on my personal instance.
Attached screenshot for your reference, it working perfectly at my end.