[Zope-DB] Localised date format

M.-A. Lemburg mal@lemburg.com
Fri, 29 Nov 2002 21:00:48 +0100

Le grande pinguin wrote:
> On Fri, Nov 29, 2002 at 06:07:58PM +0100, Charlie Clark wrote:
>>Dear list,
>>I can't seem to be able to convince Zope to use DateStyle German in 
>>SET DateStyle to German;
>>works fine in psql but is a runtime condition and I don't seem to be able 
>>to set it from within Zope.
>>The alternative of using to_char(my_date, 'DD.MM.YYYY') seems to be very 
>>resource intensive.
>>Is there a way of making DateSytle German permanent? and doing this from 
>>within Zope?
> Hello,
> if i recall right i once did submit a patch for psycopg that made 
> client encoding customizable _per connection_ but i never checked 
> whether it made it into the distro. The main problem with such things
> is the following: things like client encoding and DateStyle can only
> be set on a _per connection_ basis. Zope serializes database access 
> into one connection. So if two "Zope Applications" share the same
> database connection the are forced to use the same client encoding/date style
> etc. This _can_ quickly turn into a headache ...

I don't think you'd want to do that: the date/time format
is a user interface level format, so the application should
determine the format to be used and then apply it as necessary.
For database interaction it is important that the information
is made available in an easily accessible way, e.g. as
mxDateTime instance ;-)

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
eGenix.com -- Makers of the Python mx Extensions: mxDateTime,mxODBC,...
Python Consulting:                               http://www.egenix.com/
Python Software:                    http://www.egenix.com/files/python/