We can easily find difference between two dates with powershell. We can get difference in Days, Hours, Minutes and Seconds.
Total Days between two dates
The below powershell script show the total number of days between two dates.
$FromDate =[DateTime] "04/20/2015" $ToDate =[DateTime] "07/07/2015" ($ToDate - $FromDate).TotalDays
Total Hours between two dates
The below powershell script show the total number of hours between two times.
$FromDate =[DateTime] "07/05/2015" $ToDate =[DateTime] "07/07/2015" ($ToDate - $FromDate).TotalHours
Total Minutes between two times
$FromDate = [DateTime] "07/07/2015 1:47:31 PM" $ToDate = [DateTime] "07/07/2015 3:47:31 PM" ($ToDate - $FromDate).TotalMinutes
Advertisement