Brian Dunning's FileMaker Custom Functions

Unix_Date ( current_timestamp ; time_zone_offset )

Calculates the Unix Epoch Date

  Average rating: 4.2 (32 votes) Log in to vote

Tony Moller   Tony Moller
DCWerks, LLC
http://www.dcwerks.com/

Share on Facebook Share on Twitter

  Sample input:
Unix_Date ( Get ( CurrentTimeStamp ); 0 )
  Sample output:
1085157510

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Calculates the Unix timestamp, which is the number of seconds from 1/1/1970. If you use FileMaker's Get (CurrentTimeStamp) function to send the timestamp to the Unix_Date function, make sure you set the time_zone_offset to your local time zone (-5 is EST, -4 is EDT). Setting time_zone_offset to 0 (zero) will treat the timestamp as GMT.

Feel free to email me at tony@dcwerks.com with comments or corrections.

 

Comments

Kevin Vile   Kevin Vile, Ohio
Jul 20, 2010
A simpler method that accomplishes the same purpose (unless I am missing something) is as follows (where _timestamp and _hourOffset are the function parameters):

Let ([
min = GetAsTimestamp ( Date ( 1 ; 1 ; 1970 ) ) ;
max = GetAsTimestamp ( Date( 7 ; 8 ; 2038 ) )
];

If ( _timestamp ≥ min and _timestamp ≤ max;
GetAsNumber ( _timestamp ) - GetAsNumber ( min ) - ( _hourOffset * 3600 )
;
-1)
)
 
p10   p10, Vancouver
Jan 5, 2012
Can you use this unix epoch date to regenerate an accurate timestamp?

My understanding is: Unix Epoch dates do not account for leap seconds.
 
dr_john_pollard   dr_john_pollard, Sacramento
Aug 15, 2018
Could this be used to put in a people file, and then when you go to that person's record, it tells you what time it is for them locally?

That's what I'm looking for. It seems like it should be easy.

John
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.