| external help file | Microsoft.PowerShell.Commands.Management.dll-Help.xml | |
|---|---|---|
| Locale | en-US | |
| Module Name | Microsoft.PowerShell.Management | |
| ms.date | 06/28/2023 | |
| online version | https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-timezone?view=powershell-7.6&WT.mc_id=ps-gethelp | |
| schema | 2.0.0 | |
| aliases |
|
|
| title | Set-TimeZone |
Sets the system time zone to a specified time zone.
Set-TimeZone [-Name] <String> [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-TimeZone -Id <String> [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-TimeZone [-InputObject] <TimeZoneInfo> [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]
This cmdlet is only available on the Windows platform.
The Set-TimeZone cmdlet sets the system time zone to a specified time zone.
This example sets the time zone on the local computer to UTC.
Set-TimeZone -Id "UTC"Id : UTC
HasIanaId : True
DisplayName : (UTC) Coordinated Universal Time
StandardName : Coordinated Universal Time
DaylightName : Coordinated Universal Time
BaseUtcOffset : 00:00:00
SupportsDaylightSavingTime : False
This example sets the time zone on the local computer to UTC.
Set-TimeZone -Name 'Coordinated Universal Time' -PassThruAs we saw in the previous example, the Id and the Name of the Time Zone do not always match. The Name parameter must match the StandardName or DaylightName properties of the TimeZoneInfo object.
Note
The time zone names can vary based on the Culture settings in Windows. This example shows the
values for a system set to en-US.
A full list of Time Zone IDs can be obtained by running the following command:
Get-TimeZone -ListAvailableSpecifies the ID of the time zone that this cmdlet sets.
Type: System.String
Parameter Sets: Id
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: FalseSpecifies a TimeZoneInfo object to use as input.
Type: System.TimeZoneInfo
Parameter Sets: InputObject
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseSpecifies the name of the time zone that this cmdlet sets. A full list of Time Zone names can be
obtained by running the following command: Get-TimeZone -ListAvailable.
Type: System.String
Parameter Sets: Name
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseReturns an object representing the item with which you are working. By default, this cmdlet does not generate any output.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
By default, this cmdlet returns no output.
When you use the PassThru parameter, this cmdlet returns a TimeZoneInfo object.
PowerShell includes the following aliases for Set-TimeZone:
- Windows:
stz
This cmdlet is only available on Windows platforms.