Date & Time Calculations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Date and Time Calculation > Time to Value Commands >

Date & Time Calculations

VTT. - Value to Time

Previous Top Next


MiniRobotLanguage (MRL)

 

VTT. Command

Value to Time

 

 

Intention

 

What is the difference between  time and value?

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, we don't need Milliseconds here because TTV. does only work down to seconds. A value is this: "31006" which is about "07:36".

 

What does VTT. do?

VTT. is the counterpart to TTV. It will convert a value back to a Time.

TTV. delivers you the "number of seconds since midnight" for a specified time. It will tell you "How many seconds old your day is. And VTT.  takes that number and converts it back.

For example, you will get a  "36000" as value for the 10:00:00" and

a  "36001" as value for the "10:00:01", which is one second later.

 

What do i do with these values?

Values that represent a time, are more easy to handle. Store them in files, do calculations with them. A time is just a number of seconds with TTV. Of course you can also add or subtract seconds from this value. Here is an example:

 

' Get the time-value into variable $$TIA

$$TIA=10:00:30

TTV.$$TIA|$$TIM

 

' Subtract 30 Seconds

CAL.$$TIM=$$TIM-30

VTT.$$TIM|$$TIA

 

' Print it in the editor

DBV.$$TIA

ENR.

 

See TTV. - Time to Value for additional samples and explanations on this topic.

See DTC. - Date and Time Calculation for formatting and calculation with times and dates.

See also FMT. - Format Numeric Output for formatted numeric output.

 

Important:

You can use this time immediately for DTC. to convert it to any format you like.

Like this:

 

$$TIM=36000

VTT.$$TIM|$$RES

' change the date-format to anything you want.

DTC.$$RES|hh/nn

DBV.$$RES

ENR.

' Output is 10/00

 

 

 

Syntax

 

VTT.P1[|P2]

 

 

Parameter Explanation

 

 

P1 - Variable or number that should be converted to a time.

    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

 

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

' VTT. - Sample

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

'

$$TIA=10:00:30

TTV.$$TIA|$$TIM

' Subtract 30 Seconds

CAL.$$TIM=$$TIM-30

VTT.$$TIM|$$TIA

DBV.$$TIA

ENR.

 

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

These time-calculations depend on th 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)

    TTV. - Time to Value

    DTV. - Date to Value

    VTD. - Value to Date

    DTC. - Date and Time Calculation

    VTF. - Verify Time Format

    VDF. - Verify Date Format

    IDC. / NDC. - If Date Command

    FMT. - Format Numeric Output

    CAL. - mathematical CALculation

    CAX. - Calculate Extended