[Zope] DateTime DST query

Matthew Anderson Matthew.Anderson@ftech.net
Mon, 7 Oct 2002 11:14:56 +0100


Hi all,

I have a DateTime related query for the Zope experts :)  I am currently =
displaying the time period between two dates in the following fashion:

<dtml-var "_.DateTime('2002-06-01 00:00') - _.DateTime('2002-05-01 =
00:00')">

This generally returns a nice round number i.e. 31.0 days for the above =
example.  My problem occurs when the two dates bridge the DST boundary =
so:

<dtml-var "_.DateTime('2002-11-01 00:00') - _.DateTime('2002-10-01 =
00:00')">

would return 31.0416666667 days which is perfectly true but not a =
particularly nice way of showing a user - to whom the extra hour due to =
DST is neither here nor there! Ideally I would like to be able to check =
if the DateTime object has a DST offset, then add the extra hour to it - =
thereby ensuring that I am returned a more rounded number:

<dtml-var "_.DateTime('2002-11-01 00:00') - (_.DateTime('2002-10-01 =
00:00')+(1.0/24))">

then returns 31.0 days. Is there a method/attribute of the DateTime =
object that returns a flag telling us if a DST offset is set on the =
object?

Any help would be much appreciated :)

Matt
=20
--
Matthew Anderson - Web Developer - Frontier Internet Services Limited
Tel: 029 20 820 019   Fax: 029 20 820 037   http://www.frontier.net.uk
Statements made are at all times subject to Frontier's Terms and =
Conditions of Business, which are available upon request.