# Beta: Quote Template Customisation - DateTime Formatting

**URL:** <https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482>\
**Category:** CMS Development\
**Created:** [December 22, 2020, 5:25pm UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482 "2020-12-22T17:25:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amandaulm](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amandaulm/32/28756_2.png) [@amandaulm](https://community.hubspot.com/u/amandaulm)\
**Post date:** [December 22, 2020, 5:25pm UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482/1 "2020-12-22T17:25:29Z")

</div>

I’m trying to display the line-item-level Start Date property in the line item grid on our custom quote template. I was able to determine that this will display what I need as a 13-digit timestamp:

**{{ item.hs\_recurring\_billing\_start\_date }}**

In order to display that number as a human-readable date, I’ve been using the guidelines at this page:

> **[HubL filters - HubSpot docs](https://developers.hubspot.com/docs/cms/reference/hubl/filters)**
>
> HubL filter list and examples for HubSpot CMS developers.

However, I can’t get anything to work. Here are some formats I’ve tried applying; each one fails (I get an empty blank in place of the timestamp):

**{{ item.hs\_recurring\_billing\_start\_date|datetimeformat(‘%b %e, %Y’) }}**

**{{ item.hs\_recurring\_billing\_start\_date|datetimeformat(‘%B %e, %Y %l:%M %p’) }}**

**{{ item.hs\_recurring\_billing\_start\_date|datetimeformat(‘%c’, ‘America/New\_York’) }}**

What am I missing here to make this work?

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [December 22, 2020, 7:55pm UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482/2 "2020-12-22T19:55:42Z")

</div>

Hey @amandaulm

When you print the value without a filter what values are you getting? Could you provide them?

Could you provide the coed that you’re working with?

---

<div class="post-metadata">

**Author:** ![amandaulm](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amandaulm/32/28756_2.png) [@amandaulm](https://community.hubspot.com/u/amandaulm)\
**Post date:** [December 22, 2020, 8:30pm UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482/3 "2020-12-22T20:30:31Z")

</div>

Without the format applied, I get this style of timestamp in that table cell: **1609113600000**

Here is the code block from that section; it’s built from a clone of the quote\_simple.html Hubspot template.

\<section aria-label=“quote” class=“quote”\>  
\<div class=“quote\_\_total”\>  
\<span\>Total\</span\>  
\<span\>{{ QUOTE\_TOTAL|format\_currency(LOCALE, CURRENCY, true) }}\</span\>  
\</div\>  
\<table\>  
\<thead\>  
\<tr\>  
\<th scope=“col”\>PRODUCTS\<br /\>& SERVICES\</th\>  
\<th scope=“col”\>STANDARD\<br /\>RATE\</th\>  
\<th scope=“col”\>ADDITIONAL\<br /\>HOUR RATE\</th\>  
\<th scope=“col”\>CONTRACTED\<br /\>UNITS\</th\>  
\<th scope=“col”\>START\<br /\>DATE\</th\>  
\<th\>\</th\>  
\<th scope=“col”\>YEARLY\<br /\>TOTAL\</th\>  
\</tr\>  
\</thead\>  
\<tbody class=“line-items”\>  
{% for item in LINE\_ITEMS|sort(False, False, ‘hs\_position\_on\_quote’) %}  
\<tr\>  
\<td\>{{ item.name }}\</td\>  
\<td\>{{ item.hs\_sku }}\</td\>  
\<td\>{{ (item.price)|format\_currency(LOCALE, CURRENCY, true) }}\</td\>  
\<td\>{{ item.additional\_hour\_rate|format\_currency(LOCALE, CURRENCY, true) }}\</td\>  
\<td\>{{ item.quantity }}\</td\>  
\<td\>{{ item.hs\_recurring\_billing\_start\_date }}\</td\>  
\<td\>  
{% if item.discount %}  
after {{ (item.discount)|format\_currency(LOCALE, CURRENCY, true) }} discount  
{% endif %}\</td\>  
\<td\>{{ item.amount|format\_currency(LOCALE, CURRENCY, true) }}\</td\>  
\</tr\>  
{% endfor %}  
\</tbody\>

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [December 22, 2020, 9:01pm UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482/4 "2020-12-22T21:01:50Z")

</div>

Hmm I’m stumped.

Maybe @piersg might have some insight?

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [December 23, 2020, 12:12am UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482/5 "2020-12-23T00:12:19Z")

</div>

Hi @amandaulm (and thanks @Kevin-C). I’m also not sure about this. I see no reason why the datetimeformat filter wouldn’t work; @IsaacTakushi might. Just as a shot in the dark, try

```lia-code-sample
{% set start_date = item.hs_recurring_billing_start_date %}
<td>{{ start_date|datetimeformat('%B %e, %Y') }}</td>

```

and see if that works. If it doesn’t, it could be that hs\_recurring\_billing\_start\_date isn’t actually a date object (which would be very weird) so you could try to convert it and do:

`<td>{{ item.hs_recurring_billing_start_date|unixtimestamp|datetimeformat('%B %e, %Y') }}</td>`

If all else fails, here’s a JS function to convert a unix timestamp to a readable date

```lia-code-sample
// add an id to where you want the date
<td id="startDate"></td>
<script>timeConverter({{item.hs_recurring_billing_start_date}});</script>

// add this function either in script tags or to your JS file
function timeConverter(timestamp){
 var a = new Date(timestamp);
 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
 var year = a.getFullYear();
 var month = months[a.getMonth()];
 var date = a.getDate();
 var hour = a.getHours();
 var min = a.getMinutes();
 var sec = a.getSeconds();
 var time = date + ' ' + month + ' ' + year;
 document.getElementById('startDate').textContent = time;
}

```

---

<div class="post-metadata">

**Author:** ![amandaulm](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amandaulm/32/28756_2.png) [@amandaulm](https://community.hubspot.com/u/amandaulm)\
**Post date:** [December 23, 2020, 9:38pm UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482/6 "2020-12-23T21:38:44Z")

</div>

I appreciate your thoughts here, @piersg ! Some testing notes:

For suggestion #1, using

`% set start_date`

I got the same results, where calling start\_date alone produced the long number, and adding the format resulted in a blank.

For suggestion #2, using

`{{ item.hs_recurring_billing_start_date|unixtimestamp|datetimeformat('%B %e, %Y') }}`

also produced a blank. I also tried only adding the unixtimestamp portion and not the datetimeformat, and this was blank as well, which seems odd to me.

For suggestion #3, using the JS, I put this entire part into the table where I want the cell to appear:

```lia-code-sample
// add an id to where you want the date
<td id="startDate"></td>
<script>timeConverter({{item.hs_recurring_billing_start_date}});</script>

```

Then I added the function in script tags, first to the top of the quote template file, then further down inside the “for item” loop as a test, but in both cases it works on the first line item only; subsequent lines have a blank start date cell.

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [December 26, 2020, 7:27pm UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482/7 "2020-12-26T19:27:57Z")

</div>

Hi @amandaulm, on the JS function, it would only work once because it’s targeting an id rather than a class. You can make these changes so it’ll work for all instances (this is using class and data attribute for targeting)

```lia-code-sample
<td class="startDate" data-date="{{item.hs_recurring_billing_start_date}}"></td>
<script>timeConverter({{item.hs_recurring_billing_start_date}});</script>

function timeConverter(timestamp){
 var a = new Date(timestamp);
 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
 var year = a.getFullYear();
 var month = months[a.getMonth()];
 var date = a.getDate();
 var hour = a.getHours();
 var min = a.getMinutes();
 var sec = a.getSeconds();
 var time = date + ' ' + month + ' ' + year;
 document.querySelector('.startDate[data-date="'+timestamp+'"]').textContent = time;
}

```

---

<div class="post-metadata">

**Author:** ![amandaulm](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amandaulm/32/28756_2.png) [@amandaulm](https://community.hubspot.com/u/amandaulm)\
**Post date:** [January 8, 2021, 9:06pm UTC](https://community.hubspot.com/t/beta-quote-template-customisation-datetime-formatting/29482/8 "2021-01-08T21:06:22Z")

</div>

Makes sense, @piersg ! Thanks for that.

I wanted to add here as well that Hubspot support was able to identify that the hs\_recurring\_billing\_start\_date attribute was printing as a string; adding a filter to convert the string to integer before formatting resolved the issue:

`{{ item.hs_recurring_billing_start_date|int|datetimeformat('%b %e, %Y') }}`
