≡ Menu

Find Time Zone from command line

We can find time zone of a system from command line using Systeminfo command. Exact command is given below.

systeminfo | findstr  /C:”Time Zone”

Since Systeminfo comman dumps lot of other information also hence we need to filter the output using findstr command. Running the above command on my system shows the following output.

C:\>systeminfo | findstr  /C:”Time Zone”
Time Zone:                 (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi
C:\>
7 comments… add one
  • Praveen Kushwaha

    >systeminfo | findstr /L “Zone:” work better

    • Anchal

      What if I just want the +05:30 part ? How can I get it

  • Greg Stellate

    Write the output to a string,
    Search the string for the position of “(GMT”,
    “+05:30” is in string, position +4, length 5

    The language you write in determines the correct syntax.

  • John

    Does the time zone get set by VPN concentrator or the subject device’s connection to an ISP?

  • Bob

    Since you brought up parsing the string for what you want, I’ll offer this, first:
    If you do a lot of scripting, consider getting and learning awk (or gawk, the improved, GNU version). It is a powerful, efficient language for text manipulation. Using awk, the solution is simple:
    systeminfo | awk ‘{if($2 == “Zone:”) print substr($3,5,6)}’

    On my machine, the result of the above command was:
    -06:00

    That said, note that systeminfo gives the Standard Time zone; it does not account for Daylight Savings Time (DST). If it did, the above would have given “-05:00” because I am currently in DST.

    Simpler, yet, try this, which will account for DST:
    powershell -command “get-date -uformat ‘%Z'”

    The above results in this for me:
    -05

    There are more possibilities in newer versions of Powershell, which I do not have on this old Windows 7 machine. I am running Powershell v1.0. You might want to run powershell_ise.exe and select Help->Search, then search for “time zone” or just “time.”

  • Jim

    tzutil /g

  • shraddha

    can we find time zone according to the servers location through batch scripting?

Leave a Comment