I am writing a PHP script to send data to a CloudKit database via CK Web Services. It works well with string data, but I am having trouble passing a date from PHP to a CK Date/Time field.
CK returns dates as a 13-digit TIMESTAMP. So, the following code
$timestamp = $record['created']['timestamp'];
$timestamp = $timestamp/1000;
echo '<td>'.date('m-d-Y H:i:s', $timestamp)."</td>";
echoes out
04-28-2017 12:35:19
Fine and dandy.
So I make the assumption that if CK delivers a 13-digit TIMESTAMP it should accept the same when passed to a Date/Time field.
Alas, passing $dobTimestamp
from the following
$dobTimestamp = strtotime($dob) * 1000;
Results in this BAD_REQUEST
error
Invalid value, expected type TIMESTAMP
When I go to the CK Dashboard and manually enter $dob
, CK returns a value exactly equal to $dobTimestamp
so I think passing $dobTimestamp
should work . . . but it does not.
I cannot find out what I am supposed to do in Apple's docs. Does anyone know how to pass a date to a CK Date/Time field via Web Services? Hard to imagine there would not be a way to do it.