|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Date and Time Calculation > DTO. - Date Time Operations > Date & Time Calculations |
MiniRobotLanguage (MRL)
DTO.SplitDateMask Command
Extract Day, Month, and Year from a Date
Intention
The DTO.SplitDateMask command (and its alias DTO.spdm) is used to parse a date string and extract its individual components—day, month, and year—into separate variables.
This is the inverse operation of the DTO.FormatDate command, which builds a date string from individual numeric components. It is particularly useful when you need to perform calculations or logic based on a specific part of a date.
Syntax
DTO.SplitDateMask|date|$$DAY|$$MON|$$YEA|[format]
Parameter Explanation
date - The source date string to be parsed (e.g., "25.12.2024").
$$DAY - The variable to receive the numeric day part.
$$MON - The variable to receive the numeric month part.
$$YEA - The variable to receive the numeric year part.
format - (Optional) The string mask describing the format of the `date` parameter. If omitted, a default format of "DD.MM.YYYY" is used.
Example
'**********************************************
' DTO.SplitDateMask - Sample
'**********************************************
'
' --- Example 1: Using the default format ---
$$DAA = "25.12.2024"
' The format mask is omitted, so "DD.MM.YYYY" is used by default.
DTO.SplitDateMask|$$DAA|$$DAY|$$MON|$$YEA
PRT.Default Format -> Day: $$DAY, Month: $$MON, Year: $$YEA
'
' --- Example 2: Providing a custom format mask ---
$$DAB = "2023-04-15"
$$FMT = "YYYY-MM-DD"
DTO.SplitDateMask|$$DAB|$$DAY|$$MON|$$YEA|$$FMT
PRT.Custom Format -> Day: $$DAY, Month: $$MON, Year: $$YEA
ENR.
See also: