November 5th, 2012

PowerTip: Use PowerShell to Show How Many Days Until the End of the Year

Doctor Scripto
Scripter

Summary: Learn how to use the New-TimeSpan cmdlet to see the number of days until the end of the year.

Hey, Scripting Guy! Question How can I use Windows PowerShell to see the number of days until the end of the year?

                       Hey, Scripting Guy! Answer Use the New-TimeSpan cmdlet. Use Get-Date for the start and the day you wish for the endThe following shows this technique by using a U.S. English cultural setting.

                                             New-TimeSpan -Start (get-date) -End 12/31/2012

 

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.