I have date and time in the first column of a comma delimited text file in this format:
MM/DD/YYYY H:M:S
and am trying to change it to:
YYYY/MM/DD H:M:S
I have been attempting to write a batch file for this, and have come up with this:
for /f "tokens=1-4 delims=/ " %%a in C:\Users\cs\Documents\headcur.csv do (
set "month=%%a"
set "day=%%b"
set "year=%%c"
set "mytime=%%d"
)
set "newtime=%year%/%month%/%day% %mytime%"
echo %newtime%
But nothing happens...
Could anyone point me in the right direction?
Changing date format of text file column
Moderator: DosItHelp
Re: Changing date format of text file column
Don't you liked Endoro's answer at this site?
Re: Changing date format of text file column
@Aacini
Good catch Aacini. Looks to me like Endoro is hard at work compiling a solution for the OP on that forum. It would be a shame for someone in this forum to spend a lot of time and effort to duplicate Endoro's work. Endoro is quite capable of problem solving. [/irritated
Aacini wrote:Don't you liked Endoro's answer at: <snip>
Good catch Aacini. Looks to me like Endoro is hard at work compiling a solution for the OP on that forum. It would be a shame for someone in this forum to spend a lot of time and effort to duplicate Endoro's work. Endoro is quite capable of problem solving. [/irritated
Re: Changing date format of text file column
Endoro's code skipped the data - but the OP didn't add the pertinent information for a while.
Even the code I added will modify the top header line too.
Even the code I added will modify the top header line too.