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.Standard Time Format (stf)

Previous Top Next


MiniRobotLanguage (MRL)

 

DTO.stf Command

Convert time string to standard "HH:MM:SS" format

 

Intention

 

This command takes a time string in any specified format and converts it into the standard "HH:MM:SS" format (24-hour clock).

It uses a Source Format Mask to understand the input time string. The output format is always fixed as "HH:MM:SS".

 

The source mask components are:

  HH (2-digit hour), H (1-2 digit hour)

  MM (2-digit minute), M (1-2 digit minute)

  SS (2-digit second), S (1-2 digit second)

  .XXXX (fractional part - ignored in the output)

 

Syntax

 

DTO.stf|FormatMask|TimeString[|$$ResultVar]

DTO.StandardTimeFormat|...

 

Parameter Explanation

 

P1 - FormatMask (Required)

The string mask describing the format of P2 (TimeString).

Example: "HH.MM.SS.XXXX"

 

P2 - TimeString (Required)

The time string (or a variable, e.g., $$TIM) that you want to convert.

Example: "14.30.15.5000"

 

P3 - $$ResultVar (Optional)

The variable (e.g., $$RES) where the converted time string ("HH:MM:SS") will be stored. If omitted, the result is placed on TOS.

 

 

Example

 

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

' DTO.stf - Sample

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

'

' --- Example 1: Convert from H.M.S ---

$$TIM = "9.5.30" ' 9 hours, 5 minutes, 30 seconds

$$MSK = "H.M.S"

DTO.stf|$$MSK|$$TIM|$$RES

DBV.Result 1: $$RES ' Result: "09:05:30"

'

' --- Example 2: Convert from HH-MM (ignore fractional) ---

$$TIM = "22-15"

$$MSK = "HH-MM" ' Mask only specifies hours and minutes

DTO.stf|$$MSK|$$TIM|$$RES

DBV.Result 2: $$RES ' Result: "22:15:00" (Seconds default to 00)

'

' --- Example 3: Using TOS ---

DTO.stf|"HHMMSS"|"170510"

POP.$$TOS

DBV.Result 3: $$TOS ' Result: "17:05:10"

'

ENR.

 

Remarks

 

This command is a shortcut for DTO.ReformatTime where the destination format is always "HH:MM:SS".

Any fractional part in the input time string is ignored during conversion.

If the input TimeString cannot be parsed using the provided FormatMask, an empty string is returned.

 

Limitations

 

- The command requires both FormatMask and TimeString parameters.

- Does not handle time zones or daylight saving time.

 

See also

 

    DTO. - Date Time Operations

    DTO.Reformat Time - reformat time using mask

    DTO.Parse Time - parse time into components

    DTO.Format Time - format time components to string

    DTO.Make Time Mask - create time format mask