KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Selection to JSON converts Time type field to milliseconds
PRODUCT: 4D | VERSION: 15 | PLATFORM: Mac & Win
Published On: December 3, 2015

Using SELECTION TO JSON on a Time type field will convert the time into milliseconds in the JSON string. To retrieve the time again, use the following code where $millisec is the millisecond:

$timeString:=Time string($millisec/1000) //For string
$time:=Time($millisec/1000) //For time

Example:

Assume the following time is saved in a record:


Using SELECTION TO JSON will convert the time into milliseconds: 43200000

Running the code above will convert the millisecond back to the original time string.
$millisec:=43200000
$timeString:=Time String($millisec/1000) //$timeString = "12:00:00"
$time:=Time($millisec/1000) //$time = ?12:00:00?