Printer Version Table of Contents Project Home Page
.EXAMPLE.....: 33 MIN_MATH.BAT -- "time arithmetic" in minutes
.CATEGORY....: examples
MIN_MATH.BAT -- Add or subtract time, in minutes, from the present

We get number of minutes from parm1, if present. otherwise, we use a default of 4 minutes.

Note that Minutes can contain a negative number, if we wish to subtract some minutes

@echo off
set Minutes=4
if not (%1)==() set Minutes=%1

:: get the absolute minute NOW
:: Alternatively, you can use the /A parm and the /T parm
:: to start from the date and time of your choice.
Fdate /Ff /ominute# /vAbsMin

:: add a certain number of minutes
Fdate /f#add /a%AbsMin% /b%Minutes% /VNewMin

:: display the results
Fdate /Ff /iminute# /Ofull /a%AbsMin% /p"We add %Minutes% minutes to "
Fdate /Ff /iminute# /Ofull /a%NewMin% /p"producing: "

set Minutes=
set AbsMin=
set NewMin=