Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Determine Weeks Between Dates

$
0
0

Summary: Use Windows PowerShell to determine the number of weeks between two dates.

Hey, Scripting Guy! Question 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?

Hey, Scripting Guy! Answer 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


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>