troubleshooting Question

Convert yyyy-MM-dd to MM/dd/yyyy in entire cave file using powershell

Avatar of Chris Johnsen
Chris Johnsen asked on
2 Comments1 Solution10 ViewsLast Modified:

Need to convert a file that was exported from excel that is about 98k rows and some of the dates are correct but others are.  Would like to be able to run a simple convert item on the csv files  but not able to get this to work 100% as needed using powershell.


Import-Csv -Path ‘c:\mycsvfile.csv’ |

 Select-Object -Property @{

   Name = ‘my column name’

   Expression =  {

      $_.’my column name’ | 

        Get-Date. -Format  ‘ yyyy-MM-dd’ |

        Get-Date -Format  ‘MM/dd/yyy’


},  *. | Export-Csv -Path ‘c:\mycsvfile_new.csv -NoTypeInformation

Any help would be great full as I no not really want to have to use notepad++ to update all of the incorrect values.

Thank you

"Batchelor", Developer and EE Topic Advisor
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros