<< Click to Display Table of Contents >> Navigation: 3. Script Language > Date and Time Calculation > TCA. - Time Calculation > TCA.GetPart |
MiniRobotLanguage (MRL)
TCA.GetPart
Get a part of a Timestamp
Intention
Using TCA.GetPart you can easily just get a defined Part of the Timestamp.
This is similar to TCA.Split, but here you can define the Parts you want and also the Output Format.
For this you need to use the following Placeholder which will be replaced by the values during the process.
H:M:S.x
Hereby the
- H is Hours (0 to 23)
- M is the Minutes limited 59
- S is the Seconds limited 59
- x is the Milliseconds limited to 9999
The Format of the Milliseconds is internally rounded to 4 places by prefixing zeroes.
If you specify 00:00:23 this will be treated as 00:00:00.0023
If you specify 00:00:00.023 this will be treated as 00:00:00.0230
' Get Hour only
$$LAA=25:09:03.001
$$LAB=H
TCA.Get|$$LAA|$$LAB|$$LAC
DBP.$$LAC
' Result is here "01" due to the fact that the System will automatically detect Overflow
' Over 23:00 and then calculate the difference which is "01"
' Get Minutes only
$$LAA=03:19:23.01
$$LAB=M
TCA.Get|$$LAA|$$LAB|$$LAC
DBP.$$LAC
' Result is "19"
' Get Microseconds only
$$LAA=03:19:23.0199
$$LAB=X
TCA.Get|$$LAA|$$LAB|$$LAC
DBP.$$LAC
' Result is "019"
' Get Hours:Minutes.Microseconds with Overflow
$$LAA=25:79:03.001
$$LAB=H:M.x
TCA.Get|$$LAA|$$LAB|$$LAC
DBP.$$LAC
' Result is "01:19.001" due to Overflow calculations for the "25"->"01" and the "79"->"19"
' Get Hours:Minutes.Microseconds, notice the Microseconds are filled to the Left with "00"
$$LAA=23:59:03.98
$$LAB=H:M.x
TCA.Get|$$LAA|$$LAB|$$LAC
DBP.$$LAC
' Result is "23:59.098"
' Get Hours:Minutes.Microseconds
$$LAA=08:09:59.098
$$LAB=H:M.X
TCA.Get|$$LAA|$$LAB|$$LAC
DBP.$$LAC
ENR.
' Result is "08:09.098"
Syntax
TCA.GetPart|P1|P2[|P3]
TCA.Get|P1|P2[|P3]
Parameter Explanation
P1 - Timestamp like 08:39:40.123
If Microseconds are not 3 digits, they will be filled with "0" from left. side.
P2 - Format of Output, "H:M:S.x" -> Complete Timestamp
"H" -> Return only Hours
"S" -> Return only Seconds etc.
P3 - (Optional) Variable for result. If missing, Result is stored in Variable P1.
Example
'**********************************************
' TCA.Get - Sample
'**********************************************
' Get Hours:Minutes.Microseconds
$$LAA=08:09:59.098
$$LAB=H:M.X
TCA.Get|$$LAA|$$LAB|$$LAC
DBP.$$LAC
' Result is "23:59:098"
ENR.
Remarks
-
Limitations:
-
See also:
• DAT. - Date and Time Information (System independent)
• DTC. - Date and Time Calculation
• IDC. / NDC. - If Date Command
• CAL. - mathematical CALculation