DarkMantis
DarkMantis

Reputation: 1516

Making a timestamp from 01-01-0001 to a given date/time

I have got an issue in which I am using the FileMaker PHP API which interacts with the FileMaker platform from the web.

My Issue is that the FileMaker Platform does not use the typical epoch but instead it uses a timestamp from 01-01-0001

Is there anyway to create a function which will generate a timestamp from 01-01-0001 to date('now'), for example?

Any help would be greatly appreciated.

Ps. I do understand PHP just fyi so I'm not a total newbie at PHP.

Upvotes: 1

Views: 777

Answers (1)

Chuck
Chuck

Reputation: 4892

I think you want to get a PHP timestamp from a FileMaker timestamp. If this is correct, you can use strtotime on the data returned to you by the FileMaker PHP API.

// Code that sets $record to a FileMaker_Record object
$timstamp = strtotime( $record->getField( 'timestamp_field' ) );

If, on the other hand, you have a PHP timestamp an need to convert it to a FileMaker timestamp, you can use the date function with a format string as pointed out by Tim Dietrich.

$user_update_request = $fm->newEditCommand('PHP_Users', $user->getRecordID());
$user_update_request->setField('Last_Login', date("m/d/Y h:i:s A"));
$user_update_result = $user_update_request->execute();

Upvotes: 1

Related Questions