cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP 19 is here! See the new features at jmp.com/new.
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
Choose Language Hide Translation Bar
BabyDoragon
Level II

How can I obtain the current country/region of the computer

It is necessary to record the user's region ( likes US, Canada, Europe, etc. ). May I ask what methods are available to obtain the current country/region of the computer? Is it possible to get it using Get Environment Variable()? I couldn't find which variables this function can retrieve.

 

2 REPLIES 2
txnelson
Super User

Re: How can I obtain the current country/region of the computer

I believe you have to get it from the Windows Registry. 

powershellCmd = "powershell -command \!"(Get-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation' -Name 'TimeZoneKeyName').TimeZoneKeyName\!"";

timezone = RunProgram(
  executable("cmd.exe"),
  options({"/C", powershellCmd}),
  readFunction("Text")
);

Show(timezone);
Jim
BabyDoragon
Level II

Re: How can I obtain the current country/region of the computer

I would like to confirm whether the returned timezone information differentiates between specific regions.
For example, both Japan and Korea are in the +9 timezone—will it return "Tokyo Standard Time" and "Seoul Standard Time" separately?
Or will it show the same name for both, such as "Tokyo Standard Time," to indicate the timezone?

Recommended Articles