How to convert UTC timezone in email to CET?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2022 03:55 PM
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.
- Labels:
-
Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2022 06:16 PM
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
*/
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 09:04 AM
Please mark the question as answered if it did to close it out.
Thank you
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2022 09:04 AM
Please mark the question as answered if it did to close it out.
Thank you
Vinod Kumar Kachineni
Community Rising Star 2022