# Best practice for setting deal close dates via API?

**URL:** <https://community.hubspot.com/t/best-practice-for-setting-deal-close-dates-via-api/11991>\
**Category:** APIs & Integrations\
**Tags:** object\
**Created:** [May 7, 2018, 6:43pm UTC](https://community.hubspot.com/t/best-practice-for-setting-deal-close-dates-via-api/11991 "2018-05-07T18:43:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [May 7, 2018, 6:43pm UTC](https://community.hubspot.com/t/best-practice-for-setting-deal-close-dates-via-api/11991/1 "2018-05-07T18:43:03Z")

</div>

When setting deal close dates via the API, we are sending a UTC midnight timestamp. However, Hubspot displays this close date in our local timezone in our portal. Since we are -7 hours from UTC here on the US west coast, all deals appear as if they closed a day earlier than they actually did (i.e. midnight UTC becomes 5pm the previous day PST). How can we get the best of both worlds here, sending Hubspot the format it needs, while displaying things correctly on the front-end and in reporting?

---

<div class="post-metadata">

**Author:** ![Derek\_Gervais](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/derek_gervais/32/17429_2.png) [@Derek\_Gervais](https://community.hubspot.com/u/Derek_Gervais)\
**Post date:** [May 8, 2018, 4:29pm UTC](https://community.hubspot.com/t/best-practice-for-setting-deal-close-dates-via-api/11991/2 "2018-05-08T16:29:00Z")

</div>

Hi @cc2,

Close Date is a `datetime` property, so you can send a complete unix timestamp and the HubSpot UI will display the full date & time. Only `date` properties need to be set to UTC midnight; check out the following developer doc for more details:

![]() [developers.hubspot.com](https://developers.hubspot.com/docs/faq/how-should-timestamps-be-formatted-for-hubspots-apis)

### [How should timestamps be formatted for HubSpot’s APIs?](https://developers.hubspot.com/docs/faq/how-should-timestamps-be-formatted-for-hubspots-apis)

HubSpot API endpoints accept UNIX formatted timestamps in milliseconds. Most scripting languages have built-in functions or existing libraries that handle time conversion, but you must ensure that your timestamp values are in the correct UNIX…

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [May 8, 2018, 4:39pm UTC](https://community.hubspot.com/t/best-practice-for-setting-deal-close-dates-via-api/11991/3 "2018-05-08T16:39:51Z")

</div>

Thanks! Thought it was just a date field.

---

<div class="post-metadata">

**Author:** ![leo-foodnome](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/leo-foodnome/32/47092_2.png) [@leo-foodnome](https://community.hubspot.com/u/leo-foodnome)\
**Post date:** [May 6, 2020, 10:44pm UTC](https://community.hubspot.com/t/best-practice-for-setting-deal-close-dates-via-api/11991/4 "2020-05-06T22:44:56Z")

</div>

It does accept timestamp, though it has to be timestamp in midnight in utc.
