Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

formating a date reversing the ddmmyy

1 view
Skip to first unread message

Jean Pierre Daviau

unread,
Oct 2, 2009, 1:00:10 PM10/2/09
to
HI everybody,

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

---------------
E:\>xcopy *.txt shere /D:%DATE:-=/%
Param�tre non valide - /D:2009/10/02
-------------------------------
--
Jean Pierre Daviau

- - - -
Art: http://www.jeanpierredaviau.com

Pegasus [MVP]

unread,
Oct 2, 2009, 1:48:20 PM10/2/09
to

"Jean Pierre Daviau" <on...@wasenough.ca> wrote in message
news:u3YNLH4Q...@TK2MSFTNGP05.phx.gbl...

> HI everybody,
>
> I would like to transform this: 2009/10/02 into that 02/10/2009
>
>
>
> ---------------
> E:\>xcopy *.txt shere /D:%DATE:-=/%
> Param�tre non valide - /D:2009/10/02
> -------------------------------
> --
> Jean Pierre Daviau

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%


Jean Pierre Daviau

unread,
Oct 2, 2009, 2:33:37 PM10/2/09
to
Thanks ;-)

Pegasus [MVP]

unread,
Oct 2, 2009, 3:13:01 PM10/2/09
to

"Jean Pierre Daviau" <on...@wasenough.ca> wrote in message
news:O0N4a74Q...@TK2MSFTNGP06.phx.gbl...
> Thanks ;-)

Thanks for the feedback.


Al Dunbar

unread,
Oct 2, 2009, 7:41:45 PM10/2/09
to

"Pegasus [MVP]" <ne...@microsoft.com> wrote in message
news:#ayqGi4Q...@TK2MSFTNGP05.phx.gbl...

or:

@echo off
(set d1=2009/10/02)
(set d2=%d1:~8)

Al Dunbar

unread,
Oct 2, 2009, 7:45:59 PM10/2/09
to
"Pegasus [MVP]" <ne...@microsoft.com> wrote in message
news:#ayqGi4Q...@TK2MSFTNGP05.phx.gbl...
>
> "Jean Pierre Daviau" <on...@wasenough.ca> wrote in message
> news:u3YNLH4Q...@TK2MSFTNGP05.phx.gbl...
>> HI everybody,
>>
>> I would like to transform this: 2009/10/02 into that 02/10/2009
>>
>>
>>
>> ---------------
>> E:\>xcopy *.txt shere /D:%DATE:-=/%
>> Param�tre non valide - /D:2009/10/02
>> -------------------------------
>> --
>> Jean Pierre Daviau
>
> 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

0 new messages