September 19th, 2015

PowerTip: Display Current Time with PowerShell

Doctor Scripto
Scripter

Summary: Learn how to display the current time by using Windows PowerShell.

Hey, Scripting Guy! Question How can I  use Windows PowerShell to display the time with the hour, minute, and seconds?

Hey, Scripting Guy! Answer Use the ToString method from the Get-Date cmdlet, and use the long time pattern format
           string (see Standard Date and Time Format Strings) to overload the method, for example:

(get-date).ToString('T')

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.