PowerTip: Get Week of Year with PowerShell

Doctor Scripto

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.


Discussion is closed.

Feedback usabilla icon