how to know user time zone from script include.

t venkatesh1
Tera Contributor

Hi, 

I have the date field in my catalog item and auto populate default date something, i have done that, but the issue is, it is showing different because of user based on user time zone. 

so, for that i need to write script to validate whether the user time zone is universal if not how to check the user time zone.

example ; i am in universal time zone but my colleague in japan i need to add utc + 9hrs how to write the script please suggest.

 

 

thanks

venkatesh t  

5 REPLIES 5

James Chun
Kilo Patron

Hi @t venkatesh1,

 

Are you trying to set a fixed display value for the date variable across all time zones?

 

If so, you don't need to write a script to validate the user's timezone.

Instead, try something like this:

javascript: var gdt = new GlideDate(); gdt.setDisplayValue("2021-05-21");gdt.getValue();

 

Of course, you will need to change the parameter in the setDisplayValue() to fit your needs.

 

Cheers