Date & Time Operations

<< Click to Display Table of Contents >>

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

Date & Time Operations

DTO.Date To English (dte)

Previous Top Next


MiniRobotLanguage (MRL)

 

DTO.dte Command

Toggle Date Format (Swap Day/Month)

 

Intention

 

This command toggles a date string between European (Day-First) and US (Month-First) formats by swapping the first two components of the string.

 

The aliases DTO.dte (Date To English) and DTO.dtg (Date To German) perform the exact same operation.

  If the input is "25.12.2025" (German), the output will be "12.25.2025" (English).

  If the input is "12/25/2025" (English), the output will be "25/12/2025" (German).

 

The command also works on date format masks (e.g., "DD.MM.YYYY" becomes "MM.DD.YYYY").

 

Syntax

 

DTO.dte|$$DAT[|$$RES]

DTO.dtg|$$DAT[|$$RES]

 

Parameter Explanation

 

P1 - $$DAT (Required)

The date string or date format mask (or a variable, e.g., $$DAT) to be converted.

 

P2 - $$RES (Optional)

A variable (e.g., $$RES) to store the toggled date string.

If omitted, the variable in P1 is overwritten with the result.

 

 

Example

 

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

' DTO.dte / DTO.dtg - Sample

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

'

' --- Example 1: Convert German (DD.MM) to US (MM.DD) ---

$$GER = "25.12.2025"

DTO.dte|$$GER|$$USA

DBV.German: $$GER ' Result: "25.12.2025"

DBV.US: $$USA ' Result: "12.25.2025" (Note: Separator is preserved)

'

' --- Example 2: Convert US (MM/DD) to German (DD/MM) ---

$$USA = "07/31/2024"

DTO.dtg|$$USA|$$GER

DBV.German: $$GER ' Result: "31/07/2024" (Note: DTO.dtg is same as DTO.dte)

'

' --- Example 3: Overwrite source variable ---

$$DAT = "10.01.2023"

DTO.dte|$$DAT

DBV.Toggled: $$DAT ' Result: "01.10.2023"

'

ENR.

 

Remarks

 

This command only performs a simple swap of the first two components found, separated by a delimiter (.-/\ :).

It does not validate the date or intelligently parse the format. If you pass an ISO date like "2025-10-01", it will incorrectly swap the year and month, resulting in "10-2025-01".

For more robust conversion, use the DTO.ReformatDate (refd) command, which uses explicit format masks.

 

Limitations

 

- Only works for 3-part date strings where Day and Month are the first two components.

- Does not work on dates with fewer than two separators (e.g., "YYYYMMDD").

 

See also

 

    DTO. - Date Time Operations

    DTO.Reformat Date - (Recommended replacement)

    DTO.Parse Date

    DTO.Format Date