Jul 08 2022 10:36 AM
I am importing a csv file with one of the fields being a date in this format 1/21/2022 5:41:57 PM. If I then try to output that date it appears blank when running in a ForEach, if I output it individually it works. Even a simple Write-host does not work. All the other fields work just fine.
I can convert it to a variable that works fine, but still will not output
If I try to convert it to a string I get the error message Cannot convert value "" to type "System.DateTime". Error: "String was not recognized as a valid DateTime." Again this error only happens when running in the loop.
Thanks
Jul 08 2022 05:05 PM
Hey, Harold.
You'll need to post some example code for us to be able to help you.
We don't need real data if that's an issue for you, but no code = us wildly guessing.
The only thing we can say for certain based on the error you've provided is that you are trying to convert an empty string to a date, which is not possible - meaning the error is valid.
Cheers,
Lain