# Template Update

**URL:** <https://community.silverfin.com/t/template-update/2361>\
**Category:** Templates\
**Created:** [October 28, 2022, 4:31pm UTC](https://community.silverfin.com/t/template-update/2361 "2022-10-28T16:31:35Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Kimberly\_Vlietinck](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/kimberly_vlietinck/32/1496_2.png) [@Kimberly\_Vlietinck](https://community.silverfin.com/u/Kimberly_Vlietinck)\
**Post date:** [December 19, 2022, 8:02am UTC](https://community.silverfin.com/t/template-update/2361/7 "2022-12-19T08:02:51Z")

</div>

Hi @THANAS,

To only run a new piece of code starting from a specific date you need to put the old and new piece of code into an if-condition that will look something like this:

```auto
{% assign end_date = period.end_date | date: "%Y/%m/%d" %}
{% assign change_date = "2022/01/01" | date: "%Y/%m/%d" %}

{% if end_date < change_date %}
  OLD CODE
{% else %}
  NEW CODE
{% endif %}

```

If these are large pieces of code you could also opt to put the old and the new code in a separate part and put the if-condition in the main part of the template code:

```auto
{% if end_date < change_date %}
  {% include "parts/old_code" %}
{% else %}
  {% include "parts/new_code" %}
{% endif %}

```

You can find some more information about using parts here: [CASE: use parts to avoid repetitive coding](https://community.silverfin.com/t/case-use-parts-to-avoid-repetitive-coding/2022)

Kind regards,  
Kimberly

---

_[View the full topic](https://community.silverfin.com/t/template-update/2361)._
