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, what is the syntax for it?
There's no simple way. You could write an template tag or filter. http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howto-custom-template-tags Or you could do the calculation in the view and put it into the context. Michael --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---