How to alter time zone of GlideDateTime() in scoped application
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2025 10:29 PM
- I tried writing helpers to alter GlideDateTime using setTimeZone in global script include and used it in my scoped application but i'm getting validation application error, while validating my scoped application. and it is also not working properly.
- Is there any work around to get datetime based on timezone in scoped application.
2 REPLIES 2
Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2025 04:55 AM
Hi @tamilb,
You can use the global.rmConvertTimeZone OOTB Script Include to convert between any two time zones from within a scoped application.
Example:
var gdt = new GlideDateTime();
var istDateTime = global.rmConvertTimeZone(gdt, 'UTC', 'IST');
gs.info('Current time ' + gdt + ' in IST: ' + istDateTime);
Output:
Current time 2025-10-06 11:47:33 in IST: 2025-10-06 17:17:33
This approach works because rmConvertTimeZone is defined in the global scope and is accessible from all applications scope.
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @tamilb,
If my response helped, please mark it as the accepted solution so others can benefit as well.
