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.IsTimePassed - Check if a Time has Passed

Previous Top Next


MiniRobotLanguage (MRL)

 

DTO.IsTimePassed Command

Check if a Time on the Current Day has Passed

 

Intention

 

The DTO.IsTimePassed command is used to determine if a specific time of day has already occurred on the current date. It compares the given time against the current system time and returns a boolean value (`1` for true, `0` for false).

 

This is useful for time-sensitive logic, such as checking if a daily deadline has been missed, disabling an action after a certain time, or logging events that should only occur once a certain time has been reached. The command is strict: if the given time is the current time, it is not considered "passed".

 

Syntax

 

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

 

Parameter Explanation

 

time - The time string to check against the current time. Can be a variable or a literal (e.g., "17:00:00").

 

format - (Optional) The format of the `time` string (e.g., "HH.MM"). If omitted, the standard format "HH:MM:SS" is assumed.

 

$$RES - (Optional) The variable to store the boolean result. It will contain `1` if the time has passed, otherwise `0`.

 

Example

 

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

' DTO.IsTimePassed - Sample

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

'

' Set a fixed time for demonstration.

$$TAA = "09:00:00"

' Check if 9 AM has passed today.

DTO.IsTimePassed|$$TAA||$$RES

IFV.$$RES|= |1

MBX.The time $$TAA is in the past.

ELS.

MBX.The time $$TAA has not yet passed.

EIF.

'

' Get the current time and check against it. The result should be 0.

DTO.GetCurrentTime|0|$$TAB

DTO.IsTimePassed|$$TAB||$$RES

MBX.Check if current time ($$TAB) has passed: $$RES ' Result: 0

ENR.

 

Remarks

 

This command operates strictly within the context of the current 24-hour day. It does not consider the date. For example, if it is 01:00 on Tuesday, a time of 23:00 (from Monday) will be considered "in the future" relative to the current time of day.

 

Limitations:

 

The command's output is entirely dependent on the system's clock. An incorrect system time will lead to incorrect results.

 

See also:

 

    DTO. - Date Time Operations

    DTO.Is Time Future

    DTO.Is Date Passed

    DTO.Time Diff

    DTO.Get Current Time

    DTC. - Date and Time Calculation