Personal tools

Contact Us 24/7 > 1 866.SIX FEET

Skip to content. | Skip to navigation

Home > Blog > Zope DateTime, Careful with that Dash, Eugene

EVERYONE.NET SCHEDULED MAINTENANCE will be performing maintenance on their databases Friday October 28th, 2016 between 9:00PM PT to 3:00AM PT / 12:00AM ET to 06:00AM ET. During this time, all services including web mail, POP, IMAP, and SMTP relay may experience degraded performance and inbound mail delivery delays. We apologize for any inconvenience.


Zope DateTime, Careful with that Dash, Eugene

written by david on Tuesday October 16, 2012
Comments | Filed under: , ,

Zope DateTime

The Zope DateTime library is used in several places inside of Plone. As part of the Plone 4 release cycle, the underlying Zope version was upgraded from 2.10 to 2.12. Tucked away in this version of the DateTime library is this:

Note that the Zope DateTime parser assumes timezone naive ISO strings to be in UTC rather than local time as specified.

This is an unexpected behavior change that can bite you in various ways. For example, in previous versions of Plone this is what happened:

>>> from DateTime import DateTime
>>> dash_date = '2012-10-03'
>>> slash_date = '2012/10/03'
>>> DateTime(dash_date)
>>> DateTime(slash_date)

In the current version, this happens instead:

>>> from DateTime import DateTime
>>> dash_date = '2012-10-03'
>>> slash_date = '2012/10/03'
>>> DateTime(dash_date)
DateTime('2012/10/03 00:00:00 GMT+0')
>>> DateTime(slash_date)
DateTime('2012/10/03 00:00:00 GMT-4')

Note the timezone change: one gets parsed into UTC, the other the local machine timezone. This is because the parser is using the ISO format due to the dashes in the string. This led to several unexpected behavior changes:

If you're writing custom code for Plone 4, it is a good idea to double-check how your application processes date / time input to ensure the timezone is correctly handled.

Posted by Ida Ebkes on Feb 13, 2013 02:59 PM
Thank you very much for this enlightening and compact explanation! Regards, Ida
Add comment

You can add a comment by filling out the form below. Plain text formatting.


Next Steps

Select a type of support:

Contact our sales team

First name:
Last name:
Phone Number:
Fight spam:
What is + ?
Call Us 1 866.SIX FEET