API - times/time zones not acting as expected for deal closedate (Python)



For the deal’s create endpoint (deals/v1/deal), we are sending our time over for close date as UTC milliseconds with no off set as your API docs say. We are also using the key “closedate” as name in the JSON body and all other info in the deal creation is correct.

Python Code for time: int(datetime.utcnow().strftime("%s")) * 1000

However, create date always has 7 hours added to it (screenshot below).

Basically, we would like the CHANGED TO column to match the MADE ON column in the screenshot.

It seems like our default time zone, PDT, is somehow getting accounted for twice.

Any suggestions to fix this are appreciated and let me know if any other information is useful.


Hi @McMenemy,

Can you provide a link to the contact record in this screenshot? And if possible, could you provide the request that was made to update this deal property? I’d like to take a closer look at this specific example.


Apologies, the error was actually on our end.

For anyone having a similar problem in the future: doing .timestamp or .strftime on the timezone unaware object returned by datetime.utcnow() causes the time to convert to OS local time.

To fix this either use datetime.now(tz=None) or django’s timezone.now().

Our current working line of code:

int(timezone.now().timestamp() * 1000)