I have a csv file having a column - Date. Currently its format is 7/30/2019. I want to make Date transformations using PowerShell. The required format would be: 2019-30-07. How can we do that?
I used following code to do this. But it is only doing partial for some records only. And not for other records.
Code I am using:
(get-content FileCheck.csv) -replace "(\d{2})\/(\d{2})\/(\d{4})", '$3-$2-$1' |
sc Output3.csv
Import-CSV, iterate thru that collection of objects & convert the date STRING to a date object ... and then use the.ToString()method of that object to make a new date string in the format you prefer. [grin] then, finally, save to a new CSV file withExport-CSV.