Rid - Cabbit Media and Design


No one can ever tell you your future. They can only tell you something that might have happened if they told you nothing.


Trying to figure out how to cleanly get local timezone to work in Planet

Recently started using Planet again, and was surprised that the times were all in UTC.

So far, I made the following changes in __init__.py to get it to display in the server's timezone.:

Added import calendar with the rest of the imports.

In template_info(item, date_format), added the following lines:

            secs = calendar.timegm(date)
            date = time.localtime(secs)

Changed the code under # Check for the start of a new day to the following:

            secs = calendar.timegm(newsitem.date)
            date = time.localtime(secs)
            if prev_date[:3] != date[:3]:
                prev_date = date
                item_info["new_date"] = time.strftime(new_date_format,
                                                      date)

Changed the first line under to the following:

            date = time.localtime()

Next is to get something in config.ini to select a timezone other than UTC or the server's timezone.


0 Responses to Trying to figure out how to cleanly get local timezone to work in Planet

  • There are currently no comments.


Creative Commons licenseAll work on this site is subject to a Creative Commons license | 2008 - present | Powered by Habari | Cabbit Media and Design

Listening To