You are here: Home » Community » Timezone

Timezone



Post  Timezone
Author: David Achterberg  Send Email
Date: 2004-06-02 03:59 AM


Maybe this is obvious, but how can I get the time to display for my location?




Comments: order by [Date] [Author] [Subject]

  Re:Timezone (zyon - 2004-06-02 08:58 AM)

First way : On a plone site, go to ZMI and check the "LocalTimeFormat" and "LocalLongTimeFormat" properties inside "portal_properties/site_properties".

Second way : You can modify the DateTime format with this method "mydatetimeobject.strftime(myformat)". Check the "help" link in ZMI for more informations about "DateTime" objects.

 Re:Re:Timezone (David Achterberg - 2004-06-04 06:15 AM)

First way: By "checked" do you mean check the box to the left? I believe that is only available to delete a property. I have already formatted this field to display the date in the format I want. What do I need to enter some other value to change the timezone? If so, an example would help. The ZMI help is difficult at best to understand.

  Re:Timezone (zyon - 2004-06-04 10:12 AM)

Oups sorry, check = look at ;-)

So if you had already formatted these fields, use the python scripts "toLocalizedTime" or "toPortalTime" to display a DateTime object with the good format.

use them like this inside the tal code :

tal:content="python:here.toLocalizedTime(datetime_object)"

 Re:Re:Timezone (Jarrold - 2004-12-15 10:07 AM)

Here is a similar way to get your plone instance to show the correct timezone:

customize /portal_skins/plone_scripts/toLocalizedTime to look like this:

#given a time string convert it into a DateTime and then format it appropriately #use time format of translation service from Products.CMFPlone.PloneUtilities import localized_time t = DateTime(str(time)) svTime = DateTime.toZone(t,US/Pacific) return localized_time(svTime, long_format, context)

Change US/Pacific to the timezone you want. For the calendar to show the correct date you have to edit the following:

/portal_skins/plone_portlets/portlet_calendar

change all occurances of DateTime() to DateTime(US/Pacific)

 Re:Re:Re:Timezone (Alex - 2005-03-16 08:57 AM)

This fix breaks my site. "NameError: global name US is not defined"

Did I misunderstand its supposed to say US/Pacific Where can I define the timezone?

  Re:Timezone (George from zebra print dress - 2012-05-12 04:25 PM)

I second that... George, a href="http://www.squidoo.com/zebra-print-dress">http://www.squidoo.com/zebra-print-dress