I cannot get the time difference from a certain date using Powershell like below:
$Date = '11/12/2001'
(New-TimeSpan -Start (Get-Date -Date $Date) -End (Get-Date)).ToString("'yyyy' Years 'MM' Months 'dd' Days 'hh' Hours 'mm' Minutes 'ss' Seconds'")
Error:
Exception calling "ToString" with "1" argument(s): "Input string was not in a correct format."
At line:2 char:1
+ (New-TimeSpan -Start (Get-Date -Date $Date) -End (Get-Date)).ToString ...
Why I cannot get the Years and Months elapsed?