Date & Time Calculations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Date and Time Calculation > DTO. - Date Time Operations >

Date & Time Calculations

DTO.IsTimeFuture - Check if a Time is in the Future

Previous Top Next


MiniRobotLanguage (MRL)

 

DTO.IsTimeFuture Command

Check if a Time of Day is Later Than the Current Time

 

Intention

 

The DTO.IsTimeFuture command is used to determine if a specified time of day is later than the current system time. The comparison is performed within the context of the current day.

 

This command is essential for time-based triggers and conditional logic. For instance, you could use it to prevent a process from starting before a designated time or to activate a feature only after a certain hour. It returns a simple boolean result (1 for future, 0 for past or present), which integrates seamlessly with commands like IFV.

 

Syntax

 

DTO.IsTimeFuture|time|[format]|[$$RES]

 

Parameter Explanation

 

time - The time string to be checked against the current system time.

 

format - (Optional) A format mask for the input `time` string (e.g., "HH.MM.SS"). If omitted, a standard format ("HH:MM:SS") is assumed.

 

$$RES - (Optional) The variable to store the boolean result. It will be set to `1` if the specified time is in the future, and `0` otherwise.

 

Example

 

'**********************************************

' DTO.IsTimeFuture - Sample

'**********************************************

'

' Get the current time for reference.

DTO.GetCurrentTime|0|$$NOW

' Define a time that should be in the future.

$$TAA = "23:59:00"

' Check if this time is in the future.

DTO.IsTimeFuture|$$TAA||$$RES

IFV.$$RES|= |1

MBX.It is now $$NOW. The time $$TAA is in the future.

ELS.

MBX.It is now $$NOW. The time $$TAA has already passed.

EIF.

ENR.

 

Remarks

 

The comparison is date-agnostic; it only considers the time of day. For example, at 10:00 AM, `DTO.IsTimeFuture|09:00:00` will return 0 (false), and `DTO.IsTimeFuture|11:00:00` will return 1 (true).

 

Limitations:

 

The result is dependent on the accuracy of the system's clock. If the clock is incorrect, the comparison will be as well.

 

See also:

 

    DTO. - Date Time Operations

    DTO.Is Time Passed

    DTO.Is Date Future

    DTO.Get Current Time

    IAT. / NAT. - If After Timestamp

    IBT. / NBT. - If Before Timestamp

    DTC. - Date and Time Calculation