September 23rd, 2015

PowerTip: Get Week of Year with PowerShell

Doctor Scripto
Scripter

Summary: Learn how to use Windows PowerShell to get the week of the year.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find how many weeks are left in the current year—without doing lot of math or
           calendaring stuff?

Hey, Scripting Guy! Answer Use the Get-Date cmdlet but specify a –uformat of %V:

Get-Date -UFormat %V

Note  Please remember that UFormat strings are case sensitive, so it is capital V, not lowercase v.

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.