formating a date reversing the ddmmyy

  • Thread starter Thread starter Jean Pierre Daviau
  • Start date Start date
J

Jean Pierre Daviau

HI everybody,

I would like to transform this: 2009/10/02 into that 02/10/2009
 
Jean Pierre Daviau said:
HI everybody,

I would like to transform this: 2009/10/02 into that 02/10/2009

Here you go:
@echo off
set d1=2009/10/02
for /F "tokens=1-3 delims=/" %%a in ('echo %d%') do set d2=%%c/%%b/%%a
echo %d1% %d2%
 
Pegasus said:
Here you go:
@echo off
set d1=2009/10/02
for /F "tokens=1-3 delims=/" %%a in ('echo %d%') do set d2=%%c/%%b/%%a
echo %d1% %d2%

or:

@echo off
(set d1=2009/10/02)
(set d2=%d1:~8)
for /F "tokens=1-3 delims=/" %%a in ('echo %d%') do set d2=%%c/%%b/%%a
echo %d1% %d2%
 
Pegasus said:
Here you go:
@echo off
set d1=2009/10/02
for /F "tokens=1-3 delims=/" %%a in ('echo %d%') do set d2=%%c/%%b/%%a
echo %d1% %d2%

or:

@echo off
(set d1=2009/10/02)
(set d2=%d1:~8,2%/%d1:~5,2%/%d1:~0,4%)
echo %d1% %d2%

/Al
 
Back
Top