Date & Time Calculations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Date and Time Calculation >

Date & Time Calculations

VTF. - Verify Time Format

Previous Top Next


MiniRobotLanguage (MRL)

 

VTF. Command

Verify Time Format

 

 

Intention

 

What is a  time?

A time is this: "08:37".  A time is also this ""08:37:15", which includes seconds.

While this "08:37:15:2544" is also a valid time and include Milliseconds.

 

What does VTF do?

VTF. will check that you have to do with valid times. For example:

"29:65:99" looks like it would be would be the right time format.

But its not. There are no 29 hours on each day. And you can't have 99 seconds in a minute.

 

Let us see what VTF. will do in such a case.

 

$$TIM=25:65:-2

VTF.$$TIM

DBV.$$TIM

ENR.

' Output is 23:29:02

 

It will do a little bit more then that. In case that it did any changes in the supplied date, it will also set the "Timeout Flag". This way you know that VTF. changed something in the time-format. This does not necessarily mean that your time was wrong. It just means "it was changed". See here:

 

$$TIM=25:65:-2

VTF.$$TIM

ITO.

 DBV.Timeout Flag: $$TIM

ELS.

 DBV.$$TIM  

EIF.

ENR.

' Timeout-Flag was set

' Result is 23:59:02

 

Here the timeout flag will not be set:

 

$$TIM=23:59:00

VTF.$$TIM

ITO.

 DBV.Timeout Flag: $$TIM

ELS.

 DBV.$$TIM  

EIF.

 

And the following code will set the timeout flag, because the time was changed.

 

$$TIM=23:59

VTF.$$TIM

ITO.

 DBV.Timeout Flag: $$TIM

ELS.

 DBV.$$TIM  

EIF.

 

Here is another example, what its good for:

 

$$TIM=23/45/00

VTF.$$TIM

' Result is 23:45:00

 

 

 

 

Syntax

 

VTF.P1[|P2]

 

 

Parameter Explanation

 

 

P1 - Variable or number that should be verified.

    If you specify an variable in P1, and P2 is omitted,

    then the result will be placed in that variable P1.

 

P2 -  (optional) If specified, this variable will be used for the

     resulting value.

 

 

 

Example

 

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

' VTF. - Sample

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

'

$$TIM=23:59

VTF.$$TIM

ITO.

 DBV.Timeout Flag: $$TIM

ELS.

 DBV.$$TIM  

EIF.

ENR.

 

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

These time-calculations depend on the current system time. If your system time is wrongly set, the command may also deliver the wrong time.

 

 

 

See also:

 

    1.5.1.3. Using Variables

    DAT. - Date and Time Information (System independent)

    VDF. - Verify Date Format

    TTV. - Time to Value

    DTV. - Date to Value

    VTD. - Value to Date

    DTC. - Date and Time Calculation

    IDC. / NDC. - If Date Command

    FMT. - Format Numeric Output

    CAL. - mathematical CALculation

    CAX. - Calculate Extended