How to Print Timezone in Email Scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 05:15 AM
Hi,
I using policy exception we have a field called expiration date. I have created email notifications in task table when the task is created. In task email notification I have to print expiration date along with timezone. I have created email scripts already but it is not updating the Timezone
could you please help me on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 05:26 AM
Hi @Arun91 ,
var gr = new GlideRecord('sys_user');
if(gr.get(gs.getUserID()){
var getTZ_time = getUserTime(gs.nowDateTime(), gr.time_zone);
template.print(getTZ_time + ' ' + userGR.time_zone + ' - ' + userGR.name);
//other code....
}
function getUserTime(date,usertimezone){
var timezone = Packages.java.util.TimeZone.getTimeZone(usertimezone);
var gdt = new GlideDateTime(date);
gdt.setTZ(timezone);
gdt.setNumericValue(gdt.getNumericValue() + gdt.getTZOffset());
return gdt;
}
Above code can help...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 05:31 AM
We are not using timezone in user profile and date expiration is date and time field. How we can achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 06:19 AM
then how do you determine the timezone of your exp date ?
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....