# Converting CreateDate from long int format to actual date format in Python

**URL:** <https://community.hubspot.com/t/converting-createdate-from-long-int-format-to-actual-date-format-in-python/67008>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [October 13, 2022, 1:14am UTC](https://community.hubspot.com/t/converting-createdate-from-long-int-format-to-actual-date-format-in-python/67008 "2022-10-13T01:14:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSakhuja](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SSakhuja](https://community.hubspot.com/u/SSakhuja)\
**Post date:** [October 13, 2022, 1:14am UTC](https://community.hubspot.com/t/converting-createdate-from-long-int-format-to-actual-date-format-in-python/67008/1 "2022-10-13T01:14:15Z")

</div>

Hello Everyone,

Need some help in converting longint date from Hubspot to actual date format in python.

I am currently using API calls to fetch all values, currently, the date format I am getting from API results looks like -

‘notes\_last\_updated’: {‘value’: ‘1651032900000’},

Any help will be appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![skimura](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@skimura](https://community.hubspot.com/u/skimura)\
**Post date:** [October 13, 2022, 2:16am UTC](https://community.hubspot.com/t/converting-createdate-from-long-int-format-to-actual-date-format-in-python/67008/2 "2022-10-13T02:16:47Z")

</div>

@SSakhuja

Hi.

How about this? (not tested)

```lia-code-sample
from datetime import datetime

# msec to sec
timestamp = 1651032900000 / 1000

datetime_object = datetime.fromtimestamp(timestamp)

print("datetime_object = ", datetime_object)
# datetime_object = 2022-04-27 04:15:00
# If you need, format.

```

---

<div class="post-metadata">

**Author:** ![SSakhuja](https://avatars.discourse-cdn.com/v4/letter/s/5fc32e/32.png) [@SSakhuja](https://community.hubspot.com/u/SSakhuja)\
**Post date:** [October 13, 2022, 6:04am UTC](https://community.hubspot.com/t/converting-createdate-from-long-int-format-to-actual-date-format-in-python/67008/3 "2022-10-13T06:04:04Z")

</div>

Thanks for replying.

This works with one datetime like object, however if I use like pd.to\_datetime(df[‘notes\_last\_updated’], unit=‘s’) it converts to a proper datetime object for a dataframe (assuming the bigint is seconds).

But thanks for the reply, really helped with the idea if how to approch with this one.

---

<div class="post-metadata">

**Author:** ![Fatima476](https://avatars.discourse-cdn.com/v4/letter/f/e274bd/32.png) [@Fatima476](https://community.hubspot.com/u/Fatima476)\
**Post date:** [October 7, 2026, 11:19am UTC](https://community.hubspot.com/t/converting-createdate-from-long-int-format-to-actual-date-format-in-python/67008/4 "2026-10-07T11:19:39Z")

</div>

This post was flagged by the community and is temporarily hidden.
