[Zope] how to calculate a duration ?

Webmaster Expert RH webmaster@expert-rh.com
Mon, 6 Jan 2003 18:22:19 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C2B5B0.8F7B9DF0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

hello zopers,
 
happy new year to all zopistas !!
 
in my zclasses i have a property to store a birthdate (id 1969/06/17)
I want to render the age of that person
 
but if I do (ZopeTime()-birthdate).strftime("%Y")
 
I get age in days (as described in zopebook), so i can't deduce the age
( problem w/ leap years....)
 
I'd like to get a results in years/month/days 
 
any idea???
it can't be the first time this is asked
 
thx in advance

------=_NextPart_000_0000_01C2B5B0.8F7B9DF0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3D"MSHTML 6.00.2800.1126" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>hello=20
zopers,</FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT =
face=3DArial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>happy new year =
to all=20
zopistas !!</FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT =
face=3DArial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>in my zclasses =
i have a=20
property to store a birthdate (id 1969/06/17)</FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>I&nbsp;want to =
render the=20
age of that person</FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT =
face=3DArial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>but if I do=20
(ZopeTime()-birthdate).strftime("%Y")</FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT =
face=3DArial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>I get age in =
days (as=20
described in zopebook), so i can't deduce the age ( problem w/ leap=20
years....)</FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT =
face=3DArial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>I'd like to get =
a results=20
in years/month/days </FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT =
face=3DArial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>any=20
idea???</FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>it can't be the =
first time=20
this is asked</FONT></SPAN></DIV>
<DIV><SPAN class=3D029321117-06012003><FONT =
face=3DArial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D029321117-06012003><FONT face=3DArial>thx in=20
advance</FONT></SPAN></DIV></BODY></HTML>

------=_NextPart_000_0000_01C2B5B0.8F7B9DF0--