Hi Guys, I am having a hard time getting any version of get-date to compare dates from a csv file

I have a csv with dates in format M/d/yyyy spanning future dates and dates back a few years.

I need to be able to load the dates from the csv column and if they are within 365 days of todays date or older write that row from the csv file to a new csv file.

This is what I have but it give incorrect results

$DFormat = “M/d/yyyy”
$CheckDate = get-date (Get-Date).AddDays(-365) -format $Dformat
$csv= import-csv F:\software_master_2017.csv
$OutCsv = @()
ForEach ($row in $csv) {
$oRowDate = [DateTime]::ParseExact($row.“End of support”, $DFormat, $null)
if ($CheckDate -lt $oRowDate) { $OutCsv += $row }
} $OutCsv | Export-Csv F:\results.csv -NTI

3 Spice ups

I found the problem right after I posted
I needed to change from -365 to 365 and switch the compare form
if ($CheckDate -lt $oRowDate) to if ($oRowDate -lt $CheckDate )

2 Spice ups

This should work as well

$CheckDate = get-date (Get-Date).AddDays(-365) -format "M/d/yyyy"
$csv       = import-csv "F:\\software_master_2017.csv"
$OutCsv    = @()

ForEach ($row in $csv) {
    if ([datetime]($row."End of support") -lt $CheckDate) {
        $OutCsv += $row
    }
} 

$OutCsv | Export-Csv F:\results.csv -NoTypeInformation