Solved Changing the date format in the columns of a CSV file

September 22, 2015 at 09:33:52
Specs: Windows 7
I have a requirement where I need to change the date format of the columns. Here I have provided the input file and the desired output file. Please suggest me a script that will do this work.

Input File:

17-Aug-15,516121,PSAM,14-Aug-15,O,Option,,42655,8/21/15
21-Jan-11,516121,PSAM,17-Aug-15,CU,Currency,42642,3/15/14
15-Dec-13,516121,PSAM,19-Aug-15,CU,Currency,42643,6/28/15


Required Output File:

08/17/15,516121,PSAM,08/14/15,O,Option,,42655,08/21/15
01/21/11,516121,PSAM,08/17/15,CU,Currency,42642,03/15/14
12/15/13,516121,PSAM,08/19/15,CU,Currency,42643,06/28/15

Thanks for your help and time..!!


See More: Changing the date format in the columns of a CSV file

Report •

#1
September 23, 2015 at 18:37:50
✔ Best Answer
If you're "allowed" to use vbscript, it's simple. If not, I will defer to those with more patience and/or coding skills. This vbscript snippet does the conversion you want:
'--- begin vbscript
t=formatdatetime(wscript.arguments(0),0)
wscript.echo mid(t,1,5)&right(t,2)
'---- end
(at least, it worked on my system with my settings).

Report •
Related Solutions


Ask Question