WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 2002:09:05:13:51:18
Last Updated: 2002:09:05:13:51:18