TimeIsBetween (Datalogger Clock Time is Between)

The TimeIsBetween function is used to determine if the datalogger's real-time clock falls within a range of time.

Syntax

TimeIsBetween ( BeginTime, EndTime, Interval, Units )

Remarks

The TimeIsBetween function returns True (-1) if the datalogger's real-time clock falls within the specified range; otherwise, the function returns False (0). TimeIsBetween can be used to control a process or task within the program (for instance, to control power to a device).

In this example, a modem is set to turn on between the hours of 9:00 a.m. and 5:00 p.m.

See Use Time Intervals for More than Storing Data for more information.

Parameters

BeginTime (Begin Time)

Enter the start of the time range to be used for the function. BeginTime is included in the range of time that will return True.

Type: Constant or Variable

EndTime (End Time)

Enter the end of the time range to be used for the function. EndTime is not included in the range of time that will return True.

Type: Constant or Variable

Interval

The Interval parameter is used to define how frequently the TimeIsBetween statement will evaluate as True, based on the datalogger's real-time clock. This parameter must be an integer. If a variable is used in this parameter, it is recommended to define it as a Long. Use of non-integers may result in the interval not evaluating as True when expected.

Type: Constant or Variable (declared as Long, recommended)

Units

Defines the unit of time to be used for the BeginTime, EndTime, and Interval. Right-click the parameter to display a list.

NOTE: When days are used, the first interval starts on a Monday. For example, TimeIsBetween(0,5,7,day) would perform a function every Monday through Friday.

Code Description
usec microseconds
msec milliseconds
sec seconds
min minutes
hr hours
day days

Type: Constant