Get-TimeZone

取得當前時區或可用時區清單。

語法

Name (預設值)

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

Id

Get-TimeZone
    -Id <String[]>
    [<CommonParameters>]

ListAvailable

Get-TimeZone
    [-ListAvailable]
    [<CommonParameters>]

Description

此 Cmdlet 只能在 Windows 平臺上使用。

指令長會 Get-TimeZone 取得當前時區或可用時區清單。

範例

範例 1:取得當前時區

Get-TimeZone

這個指令會取得當前時區。

範例 2:取得與指定字串相符的時區

Get-TimeZone -Name "*pac*"
Pacific Standard Time (Mexico)

(UTC-08:00) Pacific Time (US &amp; Canada)

Pacific Standard Time

SA Pacific Standard Time

Pacific SA Standard Time

West Pacific Standard Time

Central Pacific Standard Time

此指令可取得所有符合指定萬用卡的時區。

範例 3:取得所有可用的時區

Get-TimeZone -ListAvailable

此指令可取得所有可用時區。

參數

-Id

以字串陣列的形式指定此 cmdlet 所獲得的時區 ID。

參數屬性

類型:

String[]

預設值:None
支援萬用字元:False
不要顯示:False

參數集

Id
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-ListAvailable

表示此指令長可獲得所有可用時區。

參數屬性

類型:SwitchParameter
預設值:None
支援萬用字元:False
不要顯示:False

參數集

ListAvailable
Position:Named
必要:True
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Name

以字串陣列的形式指定此 cmdlet 所獲得的時區名稱。

參數屬性

類型:

String[]

預設值:None
支援萬用字元:True
不要顯示:False

參數集

Name
Position:0
必要:False
來自管線的值:True
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

CommonParameters

此 cmdlet 支援常見參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters。

輸入

String

輸出

TimeZoneInfo

備註

PowerShell 包含下列 Get-TimeZone的別名:

  • 所有平臺:
    • gtz