Date Time Fields in Email notification scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2013 06:13 AM
Hi,
we are using a mail script notification to send date time field values like 'Date Opened' & task SLA - Planned End Date time.
Date opened field is showing proper time of ticket creation in PDT time zone as default.
when it comes to Planned End Time it is not showing proper time.It is showing around 8 hours difference.
SLA Business hours is 8 - 17 hours CST
Response time is 1 hour.
CREATION DATE: 2013-12-02 04:02:10 PDT
EXPECTED RESPONSE TIME : 2013-12-02 15:00:00 PDT which is showing wrong.
I am using below script in notifications on Incident table.
var gr= new GlideRecord('task_sla');
gr.addQuery('task', current.sys_id);
gr.addNullQuery('end_time');
gr.addQuery('stage','IN','in_progress,paused');
gr.query();
while(gr.next())
{
template.print('EXPECTED RESPONSE TIME : '+gr.planned_end_time);
}
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2013 12:04 AM
Hi,
Not sure if this will work but you could try using.
template.print('EXPECTED RESPONSE TIME : '+gr.planned_end_time.getDisplayValue());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2013 12:51 AM
Thank you for the reply.
As far I Knew , if we use the getDisplayValue() it shows the time zone of the user(Update that caused to trigger the event).
I require it to be unique for all, that is in PDT Timezone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2013 06:04 AM
There is a Property that needs to be set to Display the Time Zone (glide.email.append.timezone)
http://wiki.servicenow.com/index.php?title=Using_Time_Zones#Time_Zones_in_Email_Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2014 03:00 PM
Did you solve this?
As far as I can see, if you use Javascript to print out a date time it will always print it in UTC with no time zone identifier.
I'd be interested if you found a solution.