We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Apr 26, 2021 3:39 PM
Is there a particular format I should use when exporting a DateTime value for the PHP API library?
I am creating deals via the API v3 CRM Deals endpoint using the PHP library.
I seem to be unable to set the closedate property for my deals and suspect this may be due to the datetime format that I am providing.
The create example in the API Developer Docs provides the following value when setting the closedate:
This format doesn't seem to quite align with the DateTimeInterface::ATOM constant in PHP:
Should I instead export the DateTime value as a UNIX_TIMESTAMP, multiply that value by 1000 to add milliseconds, and provide that number to the PHP library?
Or should I simply supply a raw DateTime object and trust that the PHP Library will take care of the export format for me?
Solved! Go to Solution.
Apr 26, 2021 7:02 PM
It looks like the only option that works is when I convert the DateTime to a UNIX TIMESTAMP, then multiply that number by 1000 to convert it to microseconds.
When I supplied a DateTime object I received this error message:
When I supplied an RFC3339 (ATOM) DateTime Format I received this error message:
Apr 26, 2021 7:02 PM
It looks like the only option that works is when I convert the DateTime to a UNIX TIMESTAMP, then multiply that number by 1000 to convert it to microseconds.
When I supplied a DateTime object I received this error message:
When I supplied an RFC3339 (ATOM) DateTime Format I received this error message:
Apr 27, 2021 10:51 AM - edited Apr 27, 2021 10:53 AM
for posterity: here is the doc on timestamp format
![]() | Make sure to subscribe to our YouTube channel where you can find the HubSpot Community Developer Show |