Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Time Math

 Keywords:  time logic math compare

Question:

Has anyone put together the logic to determine if a point in time is between two other points? I want to set up a config file with a start and endtime and have the script evaluate if it should be running. I started playing with the time values and thought I would see if anyone else knew how to do it. The script needs to do processing so I can just use a sleep until.

Answer:

Here is an example that uses simple compares...
Simple compares ?
starttime="2002:04:01:01:01:01"
endtime="2002:04:01:02:01:01"

testtimeA="2002:03:01:01:01:01"
testtimeB="2002:04:01:01:30:01"

if testtimeA>=starttime && testtimeA<endtime
    Message(testtimeA,"is between start and end")
else
    Message(testtimeA,"is outside of start and end")
endif


if testtimeB>=starttime && testtimeB<endtime
    Message(testtimeB,"is between start and end")
else
    Message(testtimeB,"is outside of start and end")
endif


Article ID:   W15305