# datetime not working in the submit form api

**URL:** <https://community.hubspot.com/t/datetime-not-working-in-the-submit-form-api/14877>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [June 20, 2019, 5:13am UTC](https://community.hubspot.com/t/datetime-not-working-in-the-submit-form-api/14877 "2019-06-20T05:13:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![edwinbbu](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/edwinbbu/32/21752_2.png) [@edwinbbu](https://community.hubspot.com/u/edwinbbu)\
**Post date:** [June 20, 2019, 5:13am UTC](https://community.hubspot.com/t/datetime-not-working-in-the-submit-form-api/14877/1 "2019-06-20T05:13:46Z")

</div>

I have referred the developer [documentation](https://developers.hubspot.com/docs/faq/how-should-timestamps-be-formatted-for-hubspots-apis) regarding sending timestamp for hubspot submit form api. I even tried the default 1427997766000 shown in the documentation and it is not working.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [June 20, 2019, 2:24pm UTC](https://community.hubspot.com/t/datetime-not-working-in-the-submit-form-api/14877/2 "2019-06-20T14:24:19Z")

</div>

Hi @edwinbbu , happy to help! I’ll need a bit more info first:

1. is your field a **date** field, or a **datetime** field? If you have a link to that property in your account, that would be great to have. Date fields must be set to _UTC midnight_ which is why I ask.
2. Any errors you are seeing when submitting the form via API would be awesome to see as well.
3. Are you using the v2 or v3 (with Ajax Support) endpoint?
4. Can you please link a page where your form lives and is being submitted via the API?

Thank you!

---

<div class="post-metadata">

**Author:** ![edwinbbu](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/edwinbbu/32/21752_2.png) [@edwinbbu](https://community.hubspot.com/u/edwinbbu)\
**Post date:** [June 20, 2019, 3:50pm UTC](https://community.hubspot.com/t/datetime-not-working-in-the-submit-form-api/14877/3 "2019-06-20T15:50:19Z")

</div>

Hi @cbarley ,

1. The field type is date picker. ( it is shown in contact property) .

Here is the link to the [contact property](https://app.hubspot.com/property-settings/5918065/contact/custom_date)

2. I am not seeing any error when submitting the form via api. I am submitting the datetime field(unix format) along with other fields. All other fields are getting updated.

3. I am not sending via ajax endpoint.

4. I am testing the forms via localhost so I am unable to share the link to page which is getting submitted to forms api.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [June 20, 2019, 4:19pm UTC](https://community.hubspot.com/t/datetime-not-working-in-the-submit-form-api/14877/4 "2019-06-20T16:19:24Z")

</div>

Thanks for that info @edwinbbu , since your field is just a date field, the field _must_ be set to **UTC midnight** , or the endpoint will not know what to do with that value, and HubSpot will not store the value in the CRM. Further, the V2 Forms API does not do any sort of validation, so you won’t get an error if the data isn’t sent to HubSpot, we’ll just accept anything in that instance. For that reason, the [V3 endpoint](https://developers.hubspot.com/docs/methods/forms/submit_form_v3) might be a better option. That said, if you’re not seeing an error, would you be able to send the following info:

1. The full endpoint you’re submitting data to.
2. The raw request request payload you’re sending to HubSpot.

I was able to create this simple app that submits to the V2 Forms API a while ago where I’ve added in a date picker field. This properly submits to HubSpot as a UTC midnight value in milliseconds. Feel free to use it as a guide: [https://repl.it/@cbarley10/Forms-V2-endpoint-in-Node-with-a-front-end](https://repl.it/@cbarley10/Forms-V2-endpoint-in-Node-with-a-front-end)

Here’s an example of a contact I just created via that form with the value: [Screenshot by Lightshot](http://prntscr.com/o4gx5j)

---

<div class="post-metadata">

**Author:** ![edwinbbu](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/edwinbbu/32/21752_2.png) [@edwinbbu](https://community.hubspot.com/u/edwinbbu)\
**Post date:** [June 21, 2019, 6:18am UTC](https://community.hubspot.com/t/datetime-not-working-in-the-submit-form-api/14877/5 "2019-06-21T06:18:55Z")

</div>

Thanks a lot @cbarley Finally the date type worked after converting to utc midnight format.

---

<div class="post-metadata">

**Author:** ![cbarley](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cbarley/32/82559_2.png) [@cbarley](https://community.hubspot.com/u/cbarley)\
**Post date:** [June 21, 2019, 1:33pm UTC](https://community.hubspot.com/t/datetime-not-working-in-the-submit-form-api/14877/6 "2019-06-21T13:33:13Z")

</div>

Great to hear @edwinbbu !
