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

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

{# 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:

{# 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?

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!

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

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

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.

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. This will actually return your date properties in unix timestamps and you can use the format_datetime filter to convert those into to a human readable date and time.