Valid formats for date fields when posting via HubSpot API

If anyone stumbles upon this thread and is looking for a solution using Ruby/Rails, here’s how I had to do it:

def hubspot_formatted_date(date)
 return nil if date.nil?

 Time.utc(date.year, date.month, date.day).strftime('%s%3N')
end

That last strftime puts it in 13-digit format.