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

PowerTip: Use PowerShell to Subtract Timespans

$
0
0

Summary: Subtract timespans by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to subtract 2 days and 14 hours from 12 days and 1 hour to determine the amount of time left on a project?

Hey, Scripting Guy! Answer Create two timespans using the New-Timespan cmdlet, and then subtract them from each other:

(New-TimeSpan -Days 12 -Hours 1) - (New-TimeSpan -Days 2 -Hours 14)


Viewing all articles
Browse latest Browse all 3333

Trending Articles



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