Raymond Raymond

Calculate Difference/Duration between Two Timestamps in PowerShell

event 2019-11-18 visibility 2,052 comment 0 insights toc
more_vert
insights Stats
toc Table of contents

This code snippet shows how to calculate time differences.

In PowerShell, you can use New-TimeSpan cmdlets to calculate the time differences between two dates/timestamps.

Code snippet

$current = Get-Date
$end= Get-Date
$diff= New-TimeSpan -Start $current -End $end
Write-Output "Time difference is: $diff"
More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts