- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 11:30 AM
I have an email notification that calls several mail scripts.
I am looking to add the current date to the subject of the email -- so "Notification for - Current Date"
It seems like there should be a way to do this but I can't figure it out. Has anyone done this?
Thanks,
Sandy
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:35 PM
Can you try below then,
(function runMailScript(current, template, email, email_action, event) {
var gDateTime=new GlideDateTime();
var gDate = new GlideDateTime().getDate();
var gFormat=gDate.getByFormat('EEEE, MMMM dd');
var gt = (new GlideDateTime()).getLocalTime().getByFormat('hh:mm a');
//gs.print(gt);
//var TFormat=gt.getByFormat('HH:mm');
var FinalFormat=gFormat+' '+gt;
//gs.print(FinalFormat);
template.print(FinalFormat);
})(current, template, email, email_action, event);
Output as desired.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:40 PM
Is it working the way it should or still any issues.
Also, if above comments helped you can mark it Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2021 03:59 AM
Hi Jaspal, It is giving the time but can you help such that the time zone should be according to the user's time zone???.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2020 12:59 PM
Hi Sandy,
Try this in your email script
var gdt = new GlideDateTime();
email.setSubject("Notification For - "+gdt.getDate());
Regards,
Ajay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 07:17 AM
Thank you!! this gives the date - sorry to ask but is there a way to also add the time to this?
I just want the Hour and Minute, not seconds.
Thanks again!