January 23rd, 2015

PowerTip: Pipe String to Get-Date

Doctor Scripto
Scripter

Summary: Pipe a string to the Windows PowerShell Get-Date cmdlet to convert it to a DateTime object.

Hey, Scripting Guy! Question How can I use Windows PowerShell to convert a date that is in a string format to a DateTime object?

Hey, Scripting Guy! Answer Create a pipeline, for example:

"11/14/2015" | get-date 

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.