timezone

troels knak-nielsen troelskn at gmail.com
Wed Sep 10 08:04:14 EST 2008


Thanks. If I understand the code correct, this will display the date
in the original format. However, since I collect feeds from various
places, what I really want, is to display dates in the timezone of my
own server. Meaning that I would need to first convert all dates to
UTC (As per the default venus behaviour), and then convert this to my
servers timezone. I'm a bit lost on how to do so though. Any
suggestions?

--
troels

On Tue, Sep 9, 2008 at 12:37 AM, Vasil Kolev <vasil at ludost.net> wrote:
> В 19:25 +0200 на 08.09.2008 (пн), troels knak-nielsen написа:
>> Hi list.
>>
>> I've just set up venus, and I'm having problems with displaying dates.
>> Strictly speaking, the dates are correct, but they are UTC, and my
>> local timezone isn't. How do I make everything render with my
>> preferred timezone?
>>
>> (I'm using django templates if that matters)
>
>
> I have a small patch for this, to be able to display the localtime
> instead of the gmtime, you'll have just to use 'date_local' instead of
> 'date' in the template:
>
> diff -ur v1/venus/planet/shell/tmpl.py venus/planet/shell/tmpl.py
> --- v1/venus/planet/shell/tmpl.py       2007-06-25 17:03:38.000000000
> +0300
> +++ venus/planet/shell/tmpl.py  2007-09-07 12:23:56.000000000 +0300
> @@ -101,6 +101,7 @@
>     ['date_822', Rfc822, 'updated_parsed'],
>     ['date_iso', Rfc3399, 'published_parsed'],
>     ['date_iso', Rfc3399, 'updated_parsed'],
> +    ['date_local', PlanetDate, 'updated_parsed'],
>     ['enclosure_href', String, 'links', {'rel': 'enclosure'}, 'href'],
>     ['enclosure_length', String, 'links', {'rel': 'enclosure'},
> 'length'],
>     ['enclosure_type', String, 'links', {'rel': 'enclosure'}, 'type'],
> @@ -223,6 +224,9 @@
>     output['date_iso'] = Rfc3399(date)
>     output['date_822'] = Rfc822(date)
>
> +    date2 = time.localtime()
> +    output['date_local'] = PlanetDate(date2)
> +
>     # remove new_dates and new_channels that aren't "new"
>     date = channel = None
>     for item in output['Items']:
>


More information about the devel mailing list