Contact date field is always empty after posting to forms API (yes it's in unix time)


I am trying to use the Forms API to create a contact in HubSpot after someone submits a form on my website. I have it working with the exception of my custom Trial Expires Date field. This is a date picker field I created on a contact records to store the date the trial expires.

The date is always showing empty on the newly created HubSpot contact, however the email that is sent to me (by HubSpot upon a form submission) has the expires date set and displayed correctly.

Here is a small sample of the code I am using to set the date (the expiresDate variable is a UTC DateTime object):

DateTime unixDate = new DateTime(1970, 1, 1, 0, 0, 0, expiresDate.Kind);
long expiresTimestamp = (System.Convert.ToInt64((expiresDate - unixDate).TotalSeconds)) * 1000;
dictFormValues.Add("trial_expires_date", expiresTimestamp.ToString());

Here is a screenshot of the HubSpot email I receive after submission...the date is correct.

Any ideas?


Solved. It was because there was a time component in the expires date. Once I used just the date component it worked ok.