[Zope] Subtracting PreciseTime

Dieter Maurer dieter@handshake.de
Wed, 7 Mar 2001 23:26:22 +0100 (CET)


Paul Zwarts writes:
 > I have two dates that I want to find the difference in minutes or hours
 > (preferably minutes)
 > 
 > zdate          2001/03/07 17:08:00 GMT+1
 > start_date   2001/03/07 16:41:14 GMT+1
 > 
 > What I try:
 > 
 > <dtml-var expr="_.DateTime(zdate-start_date).PreciseTime()">
Please read the "DateTime" documentation carefully.

  I expect, both "zdate" and "start_date" are DateTime
  objects.

  Then, "zdate-start_date" is a floating point number
  representing the difference in days!

  The "DateTime" constructor interprets a float as
  a number of seconds since the epoch
  which is apparently "1970/01/01 01:00:00".

  Thus, the construct above will not give you what you want.

Try:

	<dtml-var expr="(zdate-start_date)*24*60">



Dieter