I use javascript to do this sort of thing eg.
in your template call javascript function eg.
result = yearsBeforeToday('{{ model.date|date:"Y-m-d H:i:s" }}');
yearsBeforeToday is javascript function, does all the calculation for
your date.
model.date is the date value you are getting from
On Wed, May 13, Joshua Partogi wrote:
> Dear all,
>
> Is it possible to do time and or date calculation in the template?
>
> Let's say I have a DateField {% now %} and want to subtract it with an
> IntegerField (let's say 4, to get 4 years before today) in the template. If
> it's possible,
Dear all,
Is it possible to do time and or date calculation in the template?
Let's say I have a DateField {% now %} and want to subtract it with an
IntegerField (let's say 4, to get 4 years before today) in the template. If
it's possible, what is the syntax for it?
Thank you very much in
3 matches
Mail list logo