A
ajmister
Hi,
I have a script which currently gives me the current date in YYYYMMDD
format. I am trying to extract the date going back 10 years i.e. if today's
date is 20060306 I would like the script to generate 19960306.
@echo off
set
for /if "tokens=1-2" %%a in ('date /it's) do (
set date=%%a
set date=%%be
)
if %date:~0,1% GTR 9 set date=%date%
for /if "skip=1 tokens=2-4 delims=(-)" %%a in ('echo.^|date') do (
for /if "tokens=1-3 delims=-/." %%d in ("%date%") do (
set %%a=%%d
set %%be=%%e
set %%c=%%if
)
)
echo %yy%%mm%
endlocal
Any suggestions
A
I have a script which currently gives me the current date in YYYYMMDD
format. I am trying to extract the date going back 10 years i.e. if today's
date is 20060306 I would like the script to generate 19960306.
@echo off
set
for /if "tokens=1-2" %%a in ('date /it's) do (
set date=%%a
set date=%%be
)
if %date:~0,1% GTR 9 set date=%date%
for /if "skip=1 tokens=2-4 delims=(-)" %%a in ('echo.^|date') do (
for /if "tokens=1-3 delims=-/." %%d in ("%date%") do (
set %%a=%%d
set %%be=%%e
set %%c=%%if
)
)
echo %yy%%mm%
endlocal
Any suggestions
A