Get-TimeZone

Get the current time zone or a list of available time zones.

Syntax
      Get-TimeZone -Id String[] [CommonParameters]

      Get-TimeZone -ListAvailable [CommonParameters]

      Get-TimeZone [[-Name] String[]] [CommonParameters]

Key
   -Id             Specify the ID or IDs of the time zones to get.

   -ListAvailable  Get all the available time zones.

   -Name           Specify the name or names of the time zones to get.

Standard Aliases for Get-TimeZone: gtz

Examples

Get the current time zone:

PS C:\> Get-TimeZone
Pacific Standard Time

Get all available time zones:

PS C:\> Get-TimeZone -ListAvailable

Get time zones that match a specified string:

PS C:\> Get-TimeZone -Name "*pac*" | Select-Object standardname
Pacific Standard Time
SA Pacific Standard Time
...

The time zone set on a machine might not match the current location, a public web service like worldtimeapican lookup your approximate location and estimate a time zone based on your internet connection:

PS C:\> Invoke-RestMethod -Uri 'http://worldtimeapi.org/api/ip' | Select-Object timezone

“ The greatest things in life tend to happen outside our comfort zones, and doubting your ability to step outside of your comfort zone will keep you stuck” ~ Amy Morin

Related PowerShell Cmdlets

Invoke-RestMethod - Send an HTTP or HTTPS request to a RESTful web service.
Set-TimeZone - Set the system time zone to a specified time zone.
CMD: TZUTIL / A full, sortable list of time zones.


 
Copyright © 1999-2024 SS64.com
Some rights reserved