# Showing datetime field from custom object in email

**URL:** <https://community.hubspot.com/t/showing-datetime-field-from-custom-object-in-email/54532>\
**Category:** CMS Development\
**Created:** [April 6, 2022, 7:24pm UTC](https://community.hubspot.com/t/showing-datetime-field-from-custom-object-in-email/54532 "2022-04-06T19:24:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickgi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nickgi/32/42056_2.png) [@nickgi](https://community.hubspot.com/u/nickgi)\
**Post date:** [April 6, 2022, 7:24pm UTC](https://community.hubspot.com/t/showing-datetime-field-from-custom-object-in-email/54532/1 "2022-04-06T19:24:24Z")

</div>

We have a custom object called **Course** which has a datetime field called **start\_date**. How can we convert this into a pre-dertermined timezone, then output it into our email template?

The email is an autmated one which is sent via a Course workflow. I tried creating a custom module where it formats the date, the issue is that I’m not sure how to fetch the date from the custom object. Is there any way to access the custom object from inside the custom module?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [April 7, 2022, 6:33pm UTC](https://community.hubspot.com/t/showing-datetime-field-from-custom-object-in-email/54532/2 "2022-04-07T18:33:44Z")

</div>

@alyssamwilie 😀

Any chance you have some ideas for @nickgi ?

---

<div class="post-metadata">

**Author:** ![alyssamwilie](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alyssamwilie/32/2072_2.png) [@alyssamwilie](https://community.hubspot.com/u/alyssamwilie)\
**Post date:** [April 7, 2022, 7:00pm UTC](https://community.hubspot.com/t/showing-datetime-field-from-custom-object-in-email/54532/3 "2022-04-07T19:00:29Z")

</div>

@nickgi You can use the crm\_objects function to grab information from a custom object.

```lia-code-sample
{% set items = crm_objects("yourcustomobjectname") %}

{% for item in items.results %}
 {{ item.property_name|datetimeformat('%B %d, %Y) }}
{% endfor %}

```

Here’s the developer doc on this if you want to read more about it: [https://developers.hubspot.com/docs/cms/data/crm-objects](https://developers.hubspot.com/docs/cms/data/crm-objects#display-data-from-a-single-crm-record-with-the-crm-object-function)

---

<div class="post-metadata">

**Author:** ![nickgi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/nickgi/32/42056_2.png) [@nickgi](https://community.hubspot.com/u/nickgi)\
**Post date:** [April 8, 2022, 1:46pm UTC](https://community.hubspot.com/t/showing-datetime-field-from-custom-object-in-email/54532/4 "2022-04-08T13:46:15Z")

</div>

When your module is embedded into a automation workflow email, how would I go about getting the current custom object this is running on from within the code?

---

<div class="post-metadata">

**Author:** ![alyssamwilie](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/alyssamwilie/32/2072_2.png) [@alyssamwilie](https://community.hubspot.com/u/alyssamwilie)\
**Post date:** [April 8, 2022, 6:49pm UTC](https://community.hubspot.com/t/showing-datetime-field-from-custom-object-in-email/54532/5 "2022-04-08T18:49:22Z")

</div>

@nickgi I’ve not actually done that before, but there’s a feature in beta called Programmable Emails that allows personalization with custom objects in modules. You would first need to enable that feature on the module following the instructions here - [Create programmable emails](https://knowledge.hubspot.com/email/create-programmable-emails)

Then I don’t know if this is the exact code you would use for your specific case but here’s documentation to give you an idea of how to pull personalized custom object data in programmable email modules. - [https://developers.hubspot.com/docs/cms/guides/email/hubdb-crm-objects#hs\_cos\_wrapper\_widget\_1632846898051](https://developers.hubspot.com/docs/cms/guides/email/hubdb-crm-objects#hs_cos_wrapper_widget_1632846898051)  
Hope this helps!
