Hi, I'm having some issues converting a string variable to a time variable so that I can input them into a IF statement. Here is how i'm doing it at the moment -
$source = $row.CreationTime $dest = $result.CreationTime $Source = Get-Date "$source" -Format d $dest = Get-Date "$dest" -Format d write-host "source = "$source.GetType() write-host "dest = "$dest.GetType()
I found that i was not getting the results that I expected in my if statements. So I put GetType() on the end of the variables and lo and behold, they were still strings. How could I alter this code to correctly convert the strings to dates, so that I can compare them correctly?
Thank you.