PowerTip: Get Time Difference between Dates with PowerShell

The Scripting Guys

Dr Scripto

Summary: Use New-TimeSpan to produce the time difference between two dates.

Hey, Scripting Guy! Question I know I can subtract dates, but is there a Windows PoweShell cmdlet to show me the time difference between dates?

Hey, Scripting Guy! Answer Use New-TimeSpan and supply the information!
          For example, to show the difference between today and the upcoming New Year:


$EndDate=[datetime]”01/01/2014 00:00”

NEW-TIMESPAN –Start $StartDate –End $EndDate

The Scripting Guys
Dr Scripto

Follow Dr Scripto   

M13 IO 2019-04-15 01:41:20
Glad I found this oldie but goodie!!!  '
Jens Vestergaard 2019-05-27 04:00:30
Somethings fishy with the img references on this blog :/