Sorry, the mail went only to Philipp by mistake.

Hi Philipp,
Thanx for the pointers. I went through the sections of your book regarding
this. I guess I now understand my problem better. The problem is about the
time-zone and not about formatting. The Creation and Modification time
stamps seem to be the UTC time stamps, and I want the display to be
according to local time zone.

How can I do it?

With regards,

On 1/14/07, Philipp von Weitershausen <[EMAIL PROTECTED]> wrote:

Shailesh Kumar wrote:
> Hi,
> When I look at the Creation time and Modification time in any of the
> container views, it shows me the UTC time.
> Looking at
> <>: Line 174
> I found that:
>             formatter = self.request.locale.dates.getFormatter(
>                 'dateTime', 'short')
>             created = self.safe_getattr(dc, 'created', None)
>             if created is not None:
>                 info['created'] = formatter.format(created)
>             modified = self.safe_getattr(dc, 'modified', None)
>             if modified is not None:
>                 info['modified'] = formatter.format(modified)
> is being used to compute them.

No, the local formatter is used to *format* dates according to the
current locale. 8th of March this year, for example would be "3/8/2007"
in the U.S. English locale, but "08.03.2007" in the German locale.

> I am puzzled, how does the browser set its locale? I guess this must be
> a very basic question. But I am not able to figure it out.

request.locale is set according to the most preferred language/locale
returned by the IUserPreferredLanguages adapter for the request. The
default adapter reads browser's the Accept-Language header. More
advanced adapters could use cookies or something else that the user can
influence though the website directly.

My book talks about this in detail:

-- -- Professional Zope documentation and training
2nd edition of Web Component Development with Zope 3 is now shipping!

Zope3-users mailing list

Reply via email to