December 19th, 2014

PowerTip: Convert String into DateTime Object

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to convert a string into a DateTime object.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily create a System.DateTime object from a string?

Hey, Scripting Guy! Answer Use the [DateTime] type accelerator to convert the string, for example:

[datetime]"1/2/14"

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.