How to remove GMT after date & time on notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 01:18 AM
Hi All,
i have two "Date/Time" fields (EST time) on Catalog Item. when i try to call those variables on Notification Through Email script the format is as below
Start Date/Time: 2019-12-25 06:59:29 GMT
End Date/Time: 2019-12-26 06:59:31 GMT
here time time represents EST time but it is showing as GMT as servicenow having default GMT timezone.
can any one suggest how can i achieve 2019-12-25 06:59:29 EST instead of 2019-12-25 06:59:29 GMT.
Thanks,
Nagarjuna
- Labels:
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 01:25 AM
you can use setTZ().
eg:
var tz = gs.getSession().getTimeZone();
var gdt = new GlideDateTime(<fetch field value>);
gdt.setTZ(tz);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 01:25 AM
Hello
if(v.getGlideObject().getQuestion().getLabel() == '<field1_display_name>' && v.getDisplayValue() != '')
{
var date1 = v.getDisplayValue();
date1 = str.replace("GMT", "EST");
template.print('Start Date/Time: ' + date1 + '<br/>');
}
if(v.getGlideObject().getQuestion().getLabel() == '<field2_display_name>' && v.getDisplayValue() != '')
{
var date2 = v.getDisplayValue();
date2 = str.replace("GMT", "EST");
template.print('End Date/Time: ' + date2 + '<br/>');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 05:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2019 05:43 AM
Hi,
template.print will actually print whatever you want to show.
If you want to add other fields, query them (if you need to get from DB), and simply add them by using template.print(gr.field_name) //something like this.
Mark the comment as a correct answer and helpful if this helps.