KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Converting a GMT Timestamp value to a local Date and Time value
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: March 25, 2024

Here is a utility method that returns an object containing the local date and time value, converted from a time stamp value that is returned by the command Timestamp.
`

// Method: timeStamp2LocalDateTime
#DECLARE($ts : Text)->$timeStamp_o : Object
If (Count parameters=0)
  $ts:=Timestamp
End if
$timeStamp_o:=New object("date"; Date($ts); "time"; Time($ts))



Please note that the time value in the object is always saved in numeric value (seconds). To use the value in a time variable or field, make sure the value is convert it using the Time command