Tech Tip: Utility Method for Unix Time
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: March 13, 2023
Below is a utility method that will return the Unix Time format of a passed date and time or current time:
#DECLARE($date : Date; $time : Time)->$result : Real var $start_d : Date var $current_t : Text var $days_l : Integer $start_d:=!1970-01-01! If (Count parameters=0) $current_t:=Timestamp $current_t:=Substring($current_t; 1; Length($current_t)-5) $date:=Date($current_t) $time:=Time($current_t) End if $days_l:=$date-$start_d $result:=($days_l*86400)+($time+0) |