June 13th, 2014

PowerTip: Use PowerShell to Create DateTime Object for Any Date

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to easily create a DateTime object X days in the future.

Hey, Scripting Guy! Question How can I use Windows PowerShell to create a DateTime object for a date at some point in the future?

Hey, Scripting Guy! Answer Use the AddDays method from the DateTime object, for example:

(get-date).AddDays(8)

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.

Feedback