Summary: Use Windows PowerShell to determine the number of weeks between two dates.
I have a project that is broken into several major components of work. I know the start date of the project and
the end date of the project. How can I use Windows PowerShell to determine the number of weeks between
these dates so I can determine how many weeks to allocate for each milestone?
Use the New-TimeSpan cmdlet to create a timespan object that represents the amount of time between
the start date and the end date. Then divide the Days property by seven to determine the number of weeks.
Here is an example:
PS C:\> $ts = New-TimeSpan -Start 1/5/2015 -End 5/25/15
PS C:\> $ts.Days / 7
20