cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
FN
FN
Level VI

How to get the timezone from user's computer/laptop

Which will be the best or simpler way to get the current UTC time (including timezone) of the user running JMP?

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to get the timezone from user's computer/laptop

This is UTC Time:

request = New HTTP Request(
	URL("google.com"),
	Method("GET")
);
request << Send;
headers = request << Get Response Headers();
show(headers["date"]);

headers["date"] is a JSL Date object in UTC

so the timezone offset would be:

utc = headers["date"];
Hour(today()) - Hour(utc);

 

View solution in original post

6 REPLIES 6

Re: How to get the timezone from user's computer/laptop

Hi,

 

There is a post on the community here that might be able to help: https://community.jmp.com/t5/Uncharted/UTC-Time-Zone/ba-p/28942.

Re: How to get the timezone from user's computer/laptop

This is UTC Time:

request = New HTTP Request(
	URL("google.com"),
	Method("GET")
);
request << Send;
headers = request << Get Response Headers();
show(headers["date"]);

headers["date"] is a JSL Date object in UTC

so the timezone offset would be:

utc = headers["date"];
Hour(today()) - Hour(utc);

 

Re: How to get the timezone from user's computer/laptop

BTW... you can use any url. Routers/switches use UTC time.

Re: How to get the timezone from user's computer/laptop

This might be a little better, so it won't miss the boundaries

utc = headers[ "date" ];
tz = Date Difference (utc, today (), "hour" );
show (tz);
FN
FN
Level VI

Re: How to get the timezone from user's computer/laptop

Thanks Bryan, could you please edit your previous post with the improved code? I am accepting this as solution.

Re: How to get the timezone from user's computer/laptop

request = New HTTP Request(
	URL("google.com"),
	Method("GET"),
);
request << Send("blob");
headers = request << Get Response Headers();
utc = headers["date"];

tz = round((today() - utc)/inhours(1));
show(tz); 
 

This should be the complete script.

Recommended Articles