- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 10:57 PM
Hi I have a requirement to print created on date + 89 days in this format "02-Nov-2023" , but in notification it is printing like this 2023-06-04(yyyy-MM-dd)
so below is the email script I developed
Thanking you in advance ...
var nd = new GlideDateTime(current.sys_created_on);
var fd = new GlideDateTime(nd);
fd.addDaysLocalTime(89);
var dateToPrint = fd.getDate();
template.print(dateToPrint.toString());
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 11:12 PM - edited 08-03-2023 11:13 PM
Here is the sample script to print the format. Use getByFormat('dd-MMM-YYY') method
var gr = new GlideRecord("incident");
gr.addQuery("sys_id","148c06499790b110df5db8a3f153af64");
gr.query();
while(gr.next())
{
var nd = new GlideDateTime(gr.sys_created_on);
var fd = new GlideDateTime(nd);
fd.addDaysLocalTime(89);
var dateToPrint = fd.getDate();
gs.print(dateToPrint.getByFormat('dd-MMM-YYY'));
}
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 11:12 PM - edited 08-03-2023 11:13 PM
Here is the sample script to print the format. Use getByFormat('dd-MMM-YYY') method
var gr = new GlideRecord("incident");
gr.addQuery("sys_id","148c06499790b110df5db8a3f153af64");
gr.query();
while(gr.next())
{
var nd = new GlideDateTime(gr.sys_created_on);
var fd = new GlideDateTime(nd);
fd.addDaysLocalTime(89);
var dateToPrint = fd.getDate();
gs.print(dateToPrint.getByFormat('dd-MMM-YYY'));
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2023 02:45 AM
Yes it worked..thanks