[Zope] Date calculations in Zope
Greg McCall
greg.mccall@telstra.com
Sun, 15 Dec 2002 09:59:11 +1100
Hi
I am having trouble performing date calculations in Zope.
I have a variable called dob which returns a date of birth from MySQL
Ie. Date of Birth=<dtml-var dob> works fine
I would like to be able to list the current age in years and months
I can get a years calculation with the following line
Age in years = <dtml-var expr="ZopeTime().year()-dob.year()">
A similar line works using months
Months = <dtml-var expr="ZopeTime().month()-dob.month()">
I don't know how to do the month above when say you are in month 1 and you
subtract month 12
Also, how can the results be placed in a form.
Eg
<INPUT TYPE="TEXT" NAME="AgeYears" value="0">
<INPUT TYPE="TEXT" NAME="AgeMonths" value="0">
I tried putting the above dtml-var code in the value attributes without
success.
Thanks
Greg