How to convert UTC timezone in email to CET?

Rohit V Prem
Tera Guru

I have a Catalog item for Workstation Reservation. The user will submit a reservation in the CET timezone, but the confirmation mail the user will be getting is in UTC/GMT timezone. 

Here user submits as start time: 17/01/22 01:00(CET)(Catalog item), but he will get 17/01/22 00:00(UTC)(Email).

The user should get the time in the same timezone in which he submits the request, ie the CET timezone.

3 REPLIES 3

vkachineni
Kilo Sage
Kilo Sage

You should have a mail script in the notification that converts the GMT time to User time zone

 

Here is a code snippet that converts GMT to CET

var time = new GlideDateTime('2022-01-17 00:00:00');   
gs.print('GMT Time: '+time);   
       
// Set timezone  
var tz = Packages.java.util.TimeZone.getTimeZone("Europe/Madrid"); //You can get that string from user profile.

time.setTZ(tz); 

// Get offset of timezone set above   
var timeZoneOffSet = time.getTZOffset();  

// Add offset to current time   
time.setNumericValue(time.getNumericValue() + timeZoneOffSet);  

// Print date/time in desired timezone
gs.print('CET time: '+time);

/*
output
*** Script: GMT Time: 2022-01-17 00:00:00
*** Script: CET time: 2022-01-17 01:00:00
*/
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

Please mark the question as answered if it did to close it out.

Thank you

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

vkachineni
Kilo Sage
Kilo Sage

Please mark the question as answered if it did to close it out.

Thank you

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022