Windows 2012 Core Survival Guide – Date and Time settings
Learn about my 2012 Core Survival Guide here.
Date and Time settings
This blog is going to cover the basic of viewing and changing your time settings. If you are like me I seem to always forget to set the correct time zone and need to correct it after the install.
How to view Date and Time settings
Viewing the date and time is very strait forward. This is one of the simplest PowerShell cmdlet to work with.
PowerShell Command:
Get-Date
Or
Get-Date | format-list *
In the sample output below I demonstrate both of the above commands.
How to change Date and time setting
I am not sure why, but this one took me some time to figure out. None of the examples on the Get-Help showed the syntax for just setting the date and time. Below is the syntax I used to set the date and time on this computer.
PowerShell Command:
Set-date "12/12/2012 10:30 PM"
The output below shows the time was changed. Keep in mind that domain joined computers by default will sync their time from a domain controller. This can make your time change short lived.
How to View the current Time Zone
I had to use WMI calls to get the time zone. Below is the syntax I used.
PowerShell Command:
(Get-WmiObject win32_timezone).caption
As you can see below this command show you what time zone this computer is in.
How to Change the Time zone setting
I searched for a simple one line method in PowerShell to set the time zone and came up empty. The only easy way I found to do this in a one liner is using a command line utility tzutil.exe.
Command:
TZUTIL /s "US Eastern Standard Time"
How to get a complete list of Time Zones
Command
TZUTIL /l > timezone.txt
Notepad timezone.txt
Since this output is large and scrolls off the screen I piped it to an output text file and opened the file with notepad
I hope you found this useful. Please leave me a comment. Let me know if there are any core tasks you would like me to cover.
Bruce
Comments
Anonymous
June 21, 2013
You can get time zone with "w32tm /tz" alsoAnonymous
June 21, 2013
... or "TZUTIL /g"Anonymous
August 15, 2013
What you are missing to show is how to get rid of this silly idiotic stupid and wrong US date format that Micro$hit is trying to impose on "the rest of the world". What a nuissance to cover such a basic setting somewhere in the shell!?Anonymous
October 20, 2015
My time setting is correct, i don't need any changes to do.
http://colors.hdtwist.com/gulabo-lyrics-shaandaar/