Functions > Miscellaneous Functions > Example: Converting hhmmss to Time
Example: Converting hhmmss to Time
This example demonstrates the use of hhmmss as a functions and as a scaling unit.
The hhmmss function argument, shms, must adhere to one of two formats:
A string of the form "hh:mm:ss.sss" where hh (hours), mm (minutes) must be whole numbers, and ss.sss (seconds and fraction of a second).
All three values must be specified.
Use a zero in place of hh, mm, or ss if there is no corresponding value in your data.
A comma-separated list of one to three positive real numbers.
Prerequisite
Set the Unit System to SI, and the Result Format to (Decimal).
Using hhmmss
1. Set shms to a string that adheres to the "hh:mm:ss.sss" format.
Click to copy this expression
2. Pass variable shms to the hhmmss function and save results to variable T.
Click to copy this expression
Click to copy this expression
The unit and magnitude of the returned time depends on the selected Unit System.
3. Using the time result, delete the current time unit s and then on the Math tab, in the Units group, click Units and insert the hhmmss unit from the Time category.
Click to copy this expression
The time 4836.72 s is converted back to the original hours-minutes-seconds string.
4. Evaluate the hhmmss function while the minutes and seconds fields are set to zero.
Click to copy this expression
Click to copy this expression
5. Evaluate the hhmmss function while the hours and seconds fields are set to zero..
Click to copy this expression
Click to copy this expression
6. Evaluate the hhmmss function without specifying hours and minutes.
Click to copy this expression
Click to copy this expression
7. Find the comma separated list that if passed to the hhmmss function returns 4836.72 s.
a. Re-evaluate T and then change the result unit to hr.
Click to copy this expression
The result is one whole hour plus a fraction of an hour. Therefore, the first element of the list is 1.
The comma separated list now looks like 1, xx, x.x.
b. Evaluate the above fraction and change the result unit to min.
Click to copy this expression
Click to copy this expression
The fraction of the hour equals 20 whole minutes plus a fraction of a minute. Therefore, the second element of the list is 20.
The comma separated list now looks like 1, 20, x.x.
c. Evaluate the above fraction and change the result unit to s.
Click to copy this expression
Click to copy this expression
The fraction of the minute equals 36 whole seconds plus a fraction of a second. Therefore, the third element of the list is 36.72.
The final comma separated list is now 1, 20, 36.72.
d. Pass the comma separated list as argument to the hhmmss function.
Click to copy this expression
e. Evaluate 4836.72 s and then change the result unit to hhmmss.
Click to copy this expression
Was this helpful?