Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to alter time zone of GlideDateTime() in scoped application

tamilb
Tera Contributor
  • 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

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.

MIftikhar_0-1759751705088.png

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

Hi @tamilb,

 

If my response helped, please mark it as the accepted solution so others can benefit as well.