[Zope] Squishdot Post Time-Shifting Code - For Posterity

complaw@hal-pc.org complaw@hal-pc.org
Mon, 13 May 2002 20:20:59 GMT


This is for posterity.  I hope someone can use it in the future and save
themselves a little time.

The Problem:  Your Zope site (and, but extension your Squishdot site) are in a
server in one time zone, and your users are in another time zone.  Your users
are annoyed when their postings seem to be seven hours off.  While you are happy
that they notice such things, they pepper you with emails and postings to the
effect that something is wrong, when in fact, all is right.  To stop receiving
the "bug" notices, you need some code to "time shift" the time displayed by
Squishdot from your user's time zone.

The Solution:

In the index_html and posting_html DTML Methods in the Squishdot site,
replace...

<dtml-var date_posted>

with...

<dtml-let my_zone=date>
  <dtml-var "my_zone-0.2916667" fmt="%A %B %d, %Y at %I:%M %p">
</dtml-let>

.. where, in the case above, 0.2916667 is the time shift (7/24) to move from
the Netherlands to CST.  Substitute the value above for your time shift.  

The posting object has a "date" method that retuns a DateTime that you can use
to perform the arithmatic.  Many thanks to Chris Withers for his astounding
patience.

Hope that helps.

Ron