# Calculating with dates

**URL:** <https://community.silverfin.com/t/calculating-with-dates/370>\
**Category:** Templates\
**Tags:** math, attribute\_date\
**Created:** [August 11, 2017, 3:04pm UTC](https://community.silverfin.com/t/calculating-with-dates/370 "2017-08-11T15:04:14Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [April 3, 2018, 8:23am UTC](https://community.silverfin.com/t/calculating-with-dates/370/14 "2018-04-03T08:23:00Z")

</div>

@Andrew,

Within your fori-loop, after you generate your custom input-date. Like this for example (I added stripnewlines so you’ll see it better - see [here](https://community.silverfin.com/t/update-structure-newline-tag/366) for more info if needed) :

```auto

{% stripnewlines %}
{% newline %}
| {% t “Boekjaar van aanleg of terugname” %} | |{% t “Aanslagjaar” %} | {% t “Aangelegd” %} | {% t “Terugname” %} | {% t “Uitkeerbaar à 5% RV vanaf” %} |{% t “Saldo” %}
{% newline %}
|-------|-------:|-----------:|-------15%-----:|-----15%-------:|-------|-----15%-----:+
{% fori detail in current_account.details %}
{% newline %}
| {% input detail.custom.date as:date %} 
| {% input detail.custom.file as:file %} 
| {% input detail.custom.aanslagjaar %}
| {% $1+input detail.custom.value placeholder:“aangelegd” as:currency %}
| {% $2+input detail.custom.terugname as:currency %}
  
  {% assign current_date = detail.custom.date %}

  {% assign date_days = current_date+1 | date:"%d/%m/%Y" %}
  {% assign year = current_date | date:"%Y" %}
  {% assign year_5 = year | plus:5 %}

  {% capture date %}{{ date_days | date:"%d/%m" }}/{{ year_5 }}{% endcapture %}
  
| {{ date }}
| {% =$0+ detail.custom.value-detail.custom.terugname %}
{% endfori %}
{% newline %}
| | | | {{ $1 | currency }} | {{ $2 | currency }} | |{{ $0 | currency }}{% unexplained $0+current_account.value %}
{% endstripnewlines %} 

```

Be aware that I changed your custom objects into `detail.custom` everywhere! Because your are putting in custom objects into a drop that is ours (the details-drop) so if you want to write down custom objects in there, you need to use `.custom` .

One little suggestion: your code will always generate a date, even a date hasn’t been inputted. So I’d suggest putting that whole logic code into an if-statement (check if the input-date is blank or not), so you won’t see a wierd date generated while no input has been made.

Hope this helps?

---

_[View the full topic](https://community.silverfin.com/t/calculating-with-dates/370)._
