To get tomorrow's date

I need a MS-DOS Batch file that can help me get tomorrow's date.

Thank You

Need this urgently.
ben1211Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Chris DentPowerShell DeveloperCommented:

Much easier with VBScript if that's remotely acceptable:

strTomorrow = Date() + 1
wscript.echo strTomorrow

That could easily be called from a batch file or just directly.
0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
chez88Commented:
Hi ben1211,

There is a command that allows you to change / show the current date in MS DOS Prompt (type cmd from RUN)

The commands is:
To change/modify current date type : date
To show current date type: date /t

For tomorrow date, i am not sure about this..  =p

Hope it helps,
CHez
0
 
BarthaxCommented:
If it does not need to be a standard DOS component, then you might like to look at DOFF: http://www.jfitz.com/dos/ (DOFF=Date Offset).

The command line is then:

doff dd/mm/yyyy +1
(or however you need it formatting).
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
bmedwardCommented:
sorry, I have to do this...

   echo 4/30/2005
0
 
fixnixCommented:
LOL bmedward!

Although I was thinking along the lines of:

echo www.lonelylookingforadatetomorrow.com
0
 
bmedwardCommented:
Perhaps a better option, http://www.merlyn.demon.co.uk/programs/nowminus.txt
Documentation is kinda messy - get the nowminus.exe from http://www.merlyn.demon.co.uk/programs/ (http://www.merlyn.demon.co.uk/programs/nowminus.exe --direct link--)

To get tomorrow's date, run nowminus with in the following manner.
     nowminus.exe f01 d-1 r

where:
  nowminus.exe      is the exicutable
  f01                      sets the output to display date only (no time)
  d-1                      tels nowminus to add -1 to the current date.
  r                         makes it output to stdout.
0
 
LittleRed1Commented:
Just for the record, this batch script will do it for you:
--------------------------------------------------------------------
@echo off
setlocal ENABLEDELAYEDEXPANSION
:: Extract the day, month and year from the date variable
for /f "tokens=2,3,4 delims=/ " %%a in ("%date%") do (
      set day=%%a
      set month=%%b
      set year=%%c
)
:: Note - the sequence of the above will depend on your date format, this is for dd/mm/yyyy

:: Remove preceding zero
if !day! LSS 10 set day=!day:~1!
if !month! LSS 10 set month=!month:~1!

set newday=
:: Calculate whether it's leap year
set leap=no
set /a tmpvar1=!year!/4
set /a tmpvar2=!tmpvar1!*4
if "!tmpvar2!" == "!year!" set leap=yes
set /a tmpvar1=!year!/100
set /a tmpvar2=!tmpvar1!*100
if "!tmpvar2!" == "!year!" set leap=no
set /a tmpvar1=!year!/400
set /a tmpvar2=!tmpvar1!*400
if "!tmpvar2!" == "!year!" set leap=yes

:: Now we do the real work
if "!month!" == "2" (
      if "!leap!" == "yes" if !day! == 29 set newday=1&set /a month=!month!+1
      if "!leap!" == "no" if !day! == 28 set newday=1&set /a month=!month!+1
) else (
      for %%a in (4 6 9 11) do if !month! == %%a if !day! == 30 set newday=1&set /a month=!month!+1
      for %%a in (1 3 5 7 8 10 12) do if !month! == %%a if !day! == 31 set newday=1&set /a month=!month!+1
)
:: Increment year if the end of December
if not "!newday!" == "1" set /a newday=!day!+1
if "!month!" == "13" (
      set month=1
      set /a year=!year!+1
)

:: Re-add preceding zero
if !newday! LSS 10 set newday=0!newday!
if !month! LSS 10 set month=0!month!
echo Tomorrow's date is: !newday!/!month!/!year!
--------------------------------------------------------------------
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.