- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to work the timezone using PowerShell?
To get the timezone of the System, you can use the Get-TimeZone command.
Example
PS C:\> Get-TimeZone Id : Mountain Standard Time DisplayName : (UTC-07:00) Mountain Time (US & Canada) StandardName : Mountain Standard Time DaylightName : Mountain Daylight Time BaseUtcOffset : -07:00:00 SupportsDaylightSavingTime : True
To Set the TimeZone of the System, you can you the ID or the Name of the timezone.
Example
PS C:\> Set-TimeZone -Id "Pacific Standard Time" -PassThru Id : Pacific Standard Time DisplayName : (UTC-08:00) Pacific Time (US & Canada) StandardName : Pacific Standard Time DaylightName : Pacific Daylight Time BaseUtcOffset : -08:00:00 SupportsDaylightSavingTime : True
To retrieve the list of all the available timezones we need to use System.TimeZoneInfo .net class and method GetSystemTimeZones().
[System.TimeZoneInfo]::GetSystemTimeZones() |ft -AutoSize
Output
- Related Articles
- How does PowerShell Remoting work?
- How does PowerShell Pipeline work – Part 1?
- How does PowerShell Pipeline work – Part 2?
- How does string formatting work in PowerShell?
- How to change MySQL timezone?
- How to format the disk using PowerShell?
- How to traceroute using PowerShell?
- How to set time timezone and synchronize system clock using timedatectl command
- How to edit the CSV file using PowerShell?
- How to search in the file using PowerShell?
- How to install the Nuget Package using PowerShell?
- How to get the disk information using PowerShell?
- How to change the Drive letter using PowerShell?
- How to mount the ISO file using PowerShell?
- How to dismount the ISO file using PowerShell?

Advertisements