Tech Tip: Simple ways to convert time data type to seconds
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: January 30, 2019
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
When trying to convert time type into seconds, generally one misleading approach would be to use the Num() command. However this command does not allow time types as an argument and would lead to an incompatible argument error.
$sec1:=Num($currTime) // Incorrect
Instead, you can simply use basic arithmetic (+, -, *, /) against the time data type which will automatically convert it to seconds as shown below.
In addition, assigning a time data type to an object property value will also automatically convert to seconds.