Casting a column from csv as date powershell

I have a csv that looks like this

"fundName","MMFcusip","ticker","AsOfDate","SumHoldingPercent"
"BlackRock OH Muni MMP/Instit","'091927236'","COIXX","2/29/2012 12:00:00 AM","100.00000000200"
"Western Asset Inst US Treas Res","'52470G841'","CIIXX","2/29/2012 12:00:00 AM","100.00000000200"

Using powershell, how can I use "asOfDate" as the date / time when using the import-csv cmdlet?

EDIT: this is the line of code I'm working with now

$measuredDate = $today.AddDays(-21)
$staleDates = Import-Csv d:\path\file.csv | Foreach-Object {$_.AsOfDate = Get-Date $_.AsOfDate} | Where-Object {asOfDate -lt $measuredDate} | Measure-Object
+5
source share
1 answer
Import-Csv file.csv |
Where-Object { ![string]::IsNullOrWhiteSpace($_.AsOfDate) } | 
Foreach-Object {
   $_.AsOfDate = $_.AsOfDate -as [datetime]
   $_
}
+5
source

All Articles