First, I don't have access to the code I have to try to do this on the template.
I have a date that will be available on the template [%UserDate%]
I need to subtract 120 days from the provided [%UserDate%] value.
<div>
120 Days Before: [%UserDate%]
</div>
I tried to find a way to to this here:
http://template-toolkit.org/docs/modules/Template/Plugin/Date.html
and here:
https://metacpan.org/pod/Date::Calc
But either I am lost or can not find a method or way to do it.
Assuming a) that
UserDateis just a string and nothing useful like a DateTime object and b) that you have Date::Calc installed, then this seems to get you most of the way there:Testing it with
tpage:I've assumed that the date you've mentioned is dd/mm/yyyy. If you're using another, less logical date format then you'll need to adjust the order of the parameters you're passing to
Add_Delta_Days().