To get tomorrow's date

Posted on 2005-04-29
Last Modified: 2011-09-20
I need a MS-DOS Batch file that can help me get tomorrow's date.

Thank You

Need this urgently.
Question by:ben1211
    LVL 70

    Accepted Solution


    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.
    LVL 1

    Expert Comment

    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,
    LVL 19

    Expert Comment

    If it does not need to be a standard DOS component, then you might like to look at DOFF: (DOFF=Date Offset).

    The command line is then:

    doff dd/mm/yyyy +1
    (or however you need it formatting).
    LVL 6

    Expert Comment

    sorry, I have to do this...

       echo 4/30/2005
    LVL 9

    Expert Comment

    LOL bmedward!

    Although I was thinking along the lines of:

    LVL 6

    Expert Comment

    Perhaps a better option,
    Documentation is kinda messy - get the nowminus.exe from ( --direct link--)

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

      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.
    LVL 4

    Expert Comment

    Just for the record, this batch script will do it for you:
    @echo off
    :: 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!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    In a recent article here at Experts Exchange (, I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
    #Citrix #POC #XenDesktop #vCenter #VMware #ESX
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now