August 21st, 2013

PowerTip: Use PowerShell to Display Date, Time, and Hour

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to display date, time, and hour in 24-hour format.

Hey, Scripting Guy! Question How can I use Windows PowerShell to get the hour of the day in 24-hour format?

Hey, Scripting Guy! Answer Use the Get-Date cmdlet and specify the “%H” pattern to the UFormat parameter (H is case sensitive):

get-date -UFormat “%H”

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.