Xero seems to use date fields as milliseconds past the epoch 1-1-1970. All they supply is a millisecond value which I must convert. So far I have:
DB::CreateTable('xero_connect__xero',
'id I4 AUTO KEY,'.
'contact_id C(64) NOTNULL,'.
'name C(64),'.
'first_name C(64),'.
'last_name C(64),'.
'email_address C(64),'.
'pobox_address1 C(64),'.
'pobox_address2 C(64),'.
'pobox_address3 C(64),'.
'pobox_address4 C(64),'.
'pobox_city C(64),'.
'pobox_country C(64),'.
'pobox_postal_code C(64),'.
'street_address1 C(64),'.
'street_address2 C(64),'.
'street_address3 C(64),'.
'street_address4 C(64),'.
'street_city C(64),'.
'street_country C(64),'.
'street_postal_code C(64),'.
'last_updated C(64),'.
'user I4 NOT NULL' );
However, I think last_updated should be something like I4 but I suspect thats too small. I think I need at least a long.
The date date itself looks like:
["UpdatedDateUTC"]=>
string(26) "/Date(1434098286137+1200)/"
I wrote the following test code:
$mil = 1434098286137;
$seconds = $mil / 1000;
echo date("d-m-Y h:i:sa", $seconds) . PHP_EOL;
The output is "12-06-2015 08:38:06pm" which looks like its probably correct.
Recommendations?
Regards
Glenn @ Printec