is there a way to convert a Unix Seconds time in PHP to a PHP UTC time with Milliseconds? I'm trying to pass the time to the datepicer property in HubSpot but I can't get the API to accept what it wants.
Here's what I got:
$time = 1632182399;
I had did some research and found a contributor had suggested this solution: https://community.hubspot.com/t5/APIs-Integrations/Update-Custom-Date-Picker-in-Deals-through-the-API/m-p/229499
But this doesn't actually work and I don't know why. Perhaps I'm calling it wrong? This is what I was trying:
function get_time_for_hubspot($time){
$target_date = date( 'Y-m-d', strtotime( $time ) );
$timezone_object = new \DateTimeZone( 'UTC' );
$date_object = new \DateTime( $target_date, $timezone_object );
return $date_object->format( 'U' ) * 1000;
}
// Time Stamps
$starttime = strval($booking_object->start);
$endtime = strval($booking_object->end);
$starttime = get_time_for_hubspot($starttime);
$endtime = get_time_for_hubspot($endtime);
Thanks for any help.