# Custom object datetime properties are outputting as strings, not datetime objects

**URL:** <https://community.hubspot.com/t/custom-object-datetime-properties-are-outputting-as-strings-not-datetime-objects/126613>\
**Category:** CMS Development\
**Created:** [February 21, 2025, 7:45pm UTC](https://community.hubspot.com/t/custom-object-datetime-properties-are-outputting-as-strings-not-datetime-objects/126613 "2025-02-21T19:45:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thekevinpotts](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@thekevinpotts](https://community.hubspot.com/u/thekevinpotts)\
**Post date:** [February 21, 2025, 7:45pm UTC](https://community.hubspot.com/t/custom-object-datetime-properties-are-outputting-as-strings-not-datetime-objects/126613/1 "2025-02-21T19:45:21Z")

</div>

I have a custom object for webinars. One of the custom properties is a datetime field. Here is what happens.

```lia-code-sample
{# The following renders the datetime within the context of a single dynamic web page. This works as it should. #}
{% set webinar = dynamic_page_crm_object %}
{{ webinar.date_and_time }} {# renders a Unix timestamp like "1740679200000" #}

```

Within the context of **dynamic\_page\_crm\_object** , the datetime works _perfectly_.

However, this fails within the context of **crm\_objects** where I need to create a listing of all webinars. Example:

```lia-code-sample
{# for the sake of simplicity of example, I'm just calling the date_and_time property #}
{% set webinars = crm_objects("webinars","order=-date_and_time","date_and_time") %}
{% for webinar in webinars.results %}
{{ webinar.date_and_time }} {# the EXACT SAME PROPERTY renders as "2/27/25", a plain text string, NOT a Unix timestamp as expected #}
{% endfor %}

```

I can convert this text string to a proper date object via the strtodate filter like this:

`{{ webinar.date_and_time|strtodate('M/d/yy') }} {# this will correctly convert the string into a DATE object #}`

HOWEVER, the date object is not enough for webinars -- I also need the time! But in the context of crm\_objects, it seems to render as a plain text string that is all but useless for _time_-sensitive objects.

Has anyone encountered this? Or solved it?

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [February 21, 2025, 9:01pm UTC](https://community.hubspot.com/t/custom-object-datetime-properties-are-outputting-as-strings-not-datetime-objects/126613/2 "2025-02-21T21:01:47Z")

</div>

Hey @thekevinpotts,

Have you tried the **strtotime** filter?

`{{ webinar.date_and_time|strtotime("yyyy-MM-dd'T'HH:mm:ssZ") }}`

It converts the string into a datetime object.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [February 22, 2025, 1:26am UTC](https://community.hubspot.com/t/custom-object-datetime-properties-are-outputting-as-strings-not-datetime-objects/126613/3 "2025-02-22T01:26:45Z")

</div>

Additionally, if you need the unix timestamp, you could do:

`{{ webinar.date_and_time|strtotime("yyyy-MM-dd'T'HH:mm:ssZ")|unixtimestamp }}`

---

<div class="post-metadata">

**Author:** ![thekevinpotts](https://avatars.discourse-cdn.com/v4/letter/t/9de0a6/32.png) [@thekevinpotts](https://community.hubspot.com/u/thekevinpotts)\
**Post date:** [February 23, 2025, 3:41pm UTC](https://community.hubspot.com/t/custom-object-datetime-properties-are-outputting-as-strings-not-datetime-objects/126613/4 "2025-02-23T15:41:11Z")

</div>

This does not work because the incoming data is only a plain text string of a date. There is literally no time information to convert because the output of **crm\_objects** strips that away prior to outputting anything.

---

<div class="post-metadata">

**Author:** ![evaldas](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/evaldas/32/69160_2.png) [@evaldas](https://community.hubspot.com/u/evaldas)\
**Post date:** [February 24, 2025, 2:25am UTC](https://community.hubspot.com/t/custom-object-datetime-properties-are-outputting-as-strings-not-datetime-objects/126613/5 "2025-02-24T02:25:13Z")

</div>

Oh, yes the crm\_objects has some shortcomings and I just learned there’s another one!

In that case I would suggest using [GraphQL to build your dynamic pages](https://developers.hubspot.com/docs/guides/cms/content/data-driven-content/graphql/use-graphql-data-in-your-website-pages#create-dynamic-pages-using-query-data). This will actually return your date properties in unix timestamps and you can use the [format\_datetime](https://developers.hubspot.com/docs/reference/cms/hubl/filters#format_datetime) filter to convert those into to a human readable date and time.
