[Zope3-dev] mini-RFC: times and timezones

Marius Gedminas mgedmin at b4net.lt
Fri Feb 25 20:18:30 EST 2005


On Wed, Feb 23, 2005 at 10:26:42PM -0500, Gary Poster wrote:
<snip list of suggestions>
>   * Views should generally display dates (stored with a UTC timezone)  
> using something like this:
>         formatter = request.locale.dates.getFormatter('dateTime',  
> length='short')
>         tz = zope.interface.common.tzinfo.ITZInfo(request)
>         return formatter.format(zope.i18n.switchTimeZones(date, tz)

This looks like a mouthful.  Can we invent an obvious way to display
dates and times without having to remember weird three-line
incantations?  (Can anyone remember how to open a text file in Java
without looking it up?)

> Objections?  I'd like schoolbell(/tool) folks to buy in on this as  
> well, ideally.  This should be pretty easy for me to throw together if  
> everyone is ok with it.

I have no objections (although I haven't thought very deeply about the
issue).  Storing dates in UTC and converting to some other timezone on
display is the way to go.  I am not sure sure whether to use UTC
datetimes without timezone info (what datetime.utcnow returns), or store
all datetimes with a UTC tzinfo object.  A nice, pickle-efficient UTC
timezone is a prerequisite for the second choice.

Marius Gedminas
-- 
Q:      Why do mountain climbers rope themselves together?
A:      To prevent the sensible ones from going home.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20050226/ccc262ce/attachment.bin


More information about the Zope3-dev mailing list