He was writing a Powershell script.
The function of the script was to do a comparison of days pass since the file have been created.He stuck while creating the logic for it, and asked me to help him.
I told him, the logic is quite simple. Find the creation date of the file, get the today’s date and then minus old date with the new date.
And then I sent him the below script and told him to fill the gaps by himself. The only trick is here to use the New-TimeSpan cmdlet , rest all is Self-explanatory
$oldDate = (get-date).AddDays(-40)
$todaysDate = Get-Date
$timeDifference = New-TimeSpan -Start $oldDate -End $todaysDate
#The difference of Data
Or would you like to explain it for you ;o)