# HubDB date formatting

**URL:** <https://community.hubspot.com/t/hubdb-date-formatting/42250>\
**Category:** CMS Development\
**Tags:** hubdb\
**Created:** [August 12, 2021, 4:42pm UTC](https://community.hubspot.com/t/hubdb-date-formatting/42250 "2021-08-12T16:42:56Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![albertsg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/albertsg/32/99473_2.png) [@albertsg](https://community.hubspot.com/u/albertsg)\
**Post date:** [August 13, 2021, 3:08pm UTC](https://community.hubspot.com/t/hubdb-date-formatting/42250/4 "2021-08-13T15:08:52Z")

</div>

Hi @miljkovicmisa and @alyssamwilie thanks for the replies! I managed to find the solution, it was not exactly what you suggested but your replies definitely guided me in the correct way, so thank you again!

Here’s what happened:

This was the output after the pprint: (Long: 1635984000000)

It made me think that I needed to convert it to string in order to be able to use strtotime, but it didn’t work even if I did the following:

`{{row.date|string|strtotime("yyyy-MM-dd'T'HH:mm:ssZ")|datetimeformat("%B %e, %Y")}}`

Then I tried @alyssamwilie’s solution by using the function but it also didn’t work, I got this error (in long and string format):

`Error invoking function 'datetimeformat'`

At this point it was quite clear that what I needed was to convert this “long” variable to a proper timestamp format. I tried using **to\_local\_time** and it worked!

So at the end this is what I used to make it work:

`{{to_local_time(row.date)|datetimeformat("%B %e, %Y")}}`

It’s weird to me that I cannot apply the filter directly in the data obtained from HubDB, but I’m happy we managed to fix it.  
Thank you again for your help!

---

_[View the full topic](https://community.hubspot.com/t/hubdb-date-formatting/42250)._
