Link to home
Start Free TrialLog in
Avatar of Chris Johnsen
Chris Johnsen

asked on

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

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

Avatar of Qlemo
Flag of Germany image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Chris Johnsen
Chris Johnsen


Thank you for the update, this did exactly what I needed it to.  Yes I am aware of the format and that it is the correct one but it is not what the business wants to see as the end result.

Thank you again for the quick and easy response.