# Use filter output as variable value

**URL:** <https://community.hubspot.com/t/use-filter-output-as-variable-value/72512>\
**Category:** CMS Development\
**Tags:** html, starter\
**Created:** [January 10, 2023, 8:38am UTC](https://community.hubspot.com/t/use-filter-output-as-variable-value/72512 "2023-01-10T08:38:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sint0](https://avatars.discourse-cdn.com/v4/letter/s/e79b87/32.png) [@Sint0](https://community.hubspot.com/u/Sint0)\
**Post date:** [January 10, 2023, 8:38am UTC](https://community.hubspot.com/t/use-filter-output-as-variable-value/72512/1 "2023-01-10T08:38:51Z")

</div>

Trying to set a page element to only show within working hours.

Currently attempting to set the current day of week as a variable so I can then use it in an if statement to say “if Day of Week is in [1,2,3,4,5]”

{% set dowcur = {{ content.updated | format\_date(‘e’) }} %}

When I use the above, I get the following error:

encountered ‘}’, expected ‘:’

Any ideas?

---

<div class="post-metadata">

**Author:** ![Syeda\_Fatima](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/syeda_fatima/32/36951_2.png) [@Syeda\_Fatima](https://community.hubspot.com/u/Syeda_Fatima)\
**Post date:** [January 10, 2023, 9:02am UTC](https://community.hubspot.com/t/use-filter-output-as-variable-value/72512/2 "2023-01-10T09:02:03Z")

</div>

Hi @Sint0, You can use the HubL Date Filter to get the current day of the week and use that in an if statement to show or hide your page element.

For example, if you want to show the page element only between Monday and Friday, you can use the following code:

{% set dowcur = content.updated | format\_date(‘e’) %}  
{% if dowcur in [1, 2, 3, 4, 5] %}  
\<!-- Page element code here --\>  
{% endif %}

Alternatively, you can use the HubL Time Filter to check the current time and compare it to the opening and closing hours of your business.

For example, if you want to show the element between 9am and 5pm, you can use the following code:

{% set curtime = content.updated | format\_date(‘H’) %}  
{% if curtime \>= 9 and curtime \<= 17 %}  
\<!-- Page element code here --\>  
{% endif %}

For more information about using the HubL Date and Time Filters, please refer to the HubSpot Documentation: [HubL filters - HubSpot docs](https://developers.hubspot.com/docs/cms/hubl/filters)  
Hope this helps. Cheers! 🙂
