Maybe I'm old, worn out, or just stupid, but I do not get it in MODx Revolution:
If I have two template variables: one containing a date (Output type = date), and another with a number. How can I sum these together? (Think date = start of an event, and number = how many days is this event).
I need a calculation that runs as follows: (tv-StartDate plus tv-Eventlength) minus 1 day.
Or put it in another way: StartDate = 26.08.2013 plus 3 event days minus 1 day = Event end.
And the result will hopefully be 28.08.2013 (This example uses dd.mm.yyyy).
Does anyone have a suggestion to calculate this in the most efficient way?
Thank you in advance for your time!
- A small step for mankind, so why not take two...
Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!
this is untested.
use output-type: default
snippet 'adddays':
<?php
$startdate = $input;
$adddays = $options - 1;
$addtime = $adddays * 24 * 60 * 60;
return $startdate + $addtime;
[[*eventstart:strtotime:adddays=`[[*eventlength]]`:date=`%d.%m.%Y`]]
Hello Bruno,
It works!
Many thanks for your help!
- A small step for mankind, so why not take two...
Working with web production, graphic design/workflow, photo and education - but are trying to get a life in between!