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.Get Current Date (gcd)

Previous Top Next


MiniRobotLanguage (MRL)

 

DTO.GetCurrentDate Command

Get the current system date

 

Intention

 

This command retrieves the current date from the computer's system clock. You can specify the desired format for the date string.

 

Available formats:

  0: "DD.MM.YYYY" (e.g., "20.10.2025") - Default

  1: "MM-DD-YYYY" (e.g., "10-20-2025")

  2: "YYYYMMDD" (e.g., "20251020")

  3: PowerBasic DATE$ format (typically "MM-DD-YYYY")

 

Syntax

 

DTO.getcurrentdate|[Format][|$$RES]

DTO.gcd|[Format][|$$RES]

 

Parameter Explanation

 

P1 - Format (Optional)

A numeric value (0-3) specifying the desired date format. If omitted, format 0 ("DD.MM.YYYY") is used.

 

P2 - $$RES (Optional)

The variable (e.g., $$RES) where the resulting date string will be stored. If omitted, the result is placed on TOS.

 

 

Example

 

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

' DTO.gcd - Sample (Assumes current date is 20 Oct 2025)

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

'

' --- Get default format (DD.MM.YYYY) ---

DTO.gcd||$$DAT1

DBV.Default: $$DAT1 ' Result: "20.10.2025"

'

' --- Get US format (MM-DD-YYYY) ---

DTO.gcd|1|$$DAT2

DBV.US: $$DAT2 ' Result: "10-20-2025"

'

' --- Get Sortable format (YYYYMMDD) ---

DTO.gcd|2|$$DAT3

DBV.Sortable: $$DAT3 ' Result: "20251020"

'

' --- Get PB DATE$ format (MM-DD-YYYY) to TOS ---

DTO.gcd|3

POP.$$TOS

DBV.DATE$: $$TOS ' Result: "10-20-2025"

'

ENR.

 

Remarks

 

The date is based on the system's clock and regional settings.

If the format parameter is omitted or invalid, the default format (0) is used.

 

Limitations

 

- The accuracy depends on the correctness of the system clock.

 

See also

 

    DTO. - Date Time Operations

    DTO.Get Current Time - get current system time

    DTO.Format Date - format date components to string

    DTO.Parse Date - parse date into components

    DAT. - Date and Time Information