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 know the current user time zone?

sreenivassinsta
Tera Contributor

In how many ways we can find the current user time zone, and any user time zone?

1 ACCEPTED SOLUTION

Bhawana Upreti
Tera Guru

Hi,

You can try the given method.

gs.print(gs.getProperty("glide.sys.default.tz"));

If it's empty, it's America/Los Angeles

OR

var myUserObject = gs.getUser()
gs.print(myUserObject.getTZ()); -- returns the timezone of the current user

OR

var gdt = new GlideDateTime();
gs.print("Value : " + gdt.getUserTimeZone()); --TimeZone object for the current user.

To know more about timezone you can have a look at given link

Thank you!

View solution in original post

1 REPLY 1

Bhawana Upreti
Tera Guru

Hi,

You can try the given method.

gs.print(gs.getProperty("glide.sys.default.tz"));

If it's empty, it's America/Los Angeles

OR

var myUserObject = gs.getUser()
gs.print(myUserObject.getTZ()); -- returns the timezone of the current user

OR

var gdt = new GlideDateTime();
gs.print("Value : " + gdt.getUserTimeZone()); --TimeZone object for the current user.

To know more about timezone you can have a look at given link

Thank you!