|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Date and Time Calculation > DTO. - Date Time Operations > Date & Time Calculations |
MiniRobotLanguage (MRL)
DTO.IsDatePassed Command
Check if a Date is in the Past
Intention
The DTO.IsDatePassed command is a boolean function that checks if a given date has already passed relative to the current system date. It returns `1` (true) if the specified date is strictly before the current date, and `0` (false) otherwise.
This command is very useful for tasks like checking if a subscription has expired, verifying if a birthdate is in the past, or filtering out past events from a list. It compares the date part only, ignoring the time of day.
Syntax
DTO.IsDatePassed|date|[format]|[$$RES]
Parameter Explanation
date - The date string to evaluate. It can be a variable or a literal string like "01.01.2000".
format - (Optional) The format of the `date` string. If omitted, the default format "DD.MM.YYYY" is assumed.
$$RES - (Optional) The variable where the result (`1` for true, `0` for false) is stored.
Example
'**********************************************
' DTO.IsDatePassed - Sample
'**********************************************
'
' Get yesterday's date.
DTO.AddToCurrentDate|-1||$$DAA
' Check if yesterday has passed. $$RES will be 1.
DTO.IsDatePassed|$$DAA||$$RES
IFV.$$RES|= |1
MBX.Check 1: Yesterday ($$DAA) is in the past.
EIF.
'
' Check if today's date has passed. $$RES will be 0.
DTO.GetCurrentDate|0|$$DAB
DTO.IsDatePassed|$$DAB||$$RES
IFV.$$RES|= |0
MBX.Check 2: Today ($$DAB) is not considered to have passed.
EIF.
ENR.
Remarks
A date is considered to have "passed" if it is any day before the current system date. The current date itself will return `0` (false).
Limitations:
The command's result is entirely dependent on the system clock of the computer running the script.
See also:
• IDC. / NDC. - If Date Command