Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

[datetime]::ParseExact questions

$
0
0

So, i'm working with importing a csv file and the format of the one of the columns is 08/15/2013 11:00

 

So, I am just trying a few things with no success..

Format of column is 8/15/2013 8:38

First, I tried something like this

PS C:\powershell> $test = import-csv c:\test.csv | select Severity,@{Name = "Date";E={[datetime]::parseexact("$_.triggered","MMM/dd/yyyy HH:mm",$Null)}}

That didn't do it for me.. so, then I tried

PS C:\powershell>  $test = import-csv c:\test.csv | select Severity,@{Name = "Date";E={[datetime]::parseexact("$_.triggered","m/d/yyyy H:m",$Null)}}

I need to import the object as a date object b/c the plan is to use the (get-date).adddays method to query on results..

 

Any advice would be greatly appreciated it.


Thanks


Viewing all articles
Browse latest Browse all 6937

Trending Articles