I also posted this on the powershell usenet groups, but I think it is mostly dead now.
I am in over my head working on a script. Working with both powershell and log parser. I am currently trying to take csv input and output into a accdb. I have a good working script, with one problem.
One of my fields should be of type datetime. However the csv that exports from powershell via export-csv makes it a string. I would prefer for it to be a datetime format. I have looked into type casting (with LogParser) and into ParseExact (with powershell), but I am lost.
Here is an example of what the csv that export-csv is making:
"TIME","TEMP","HUMID","DEWPT"
"06/28/2011 12:53:13","70.9","79.8","63.6"
"06/28/2011 12:23:07","70.8","78.6","63.1"
"06/28/2011 11:53:00","70.8","78.9","63.2"
"06/28/2011 11:22:53","70.7","78.4","62.9"
Here is what I've come up with for the ParseExact (in powershell):
{ [datetime]::ParseExact($_."TIME","MM'/'dd'/'YYYY' 'HH':'MM':'SS") }
If you need to see the code I am using to append the csv data into the accdb database let me know and I'll post it. I have no preference on where the cast happens. I make the CSV in powershell and I copy it to a table in Access via logparser.
Thanks for looking.