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.