A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/086814.html below:

Formatting RFC 822 date

Formatting RFC 822 dateCarey Evans careye at spamcop.net
Sun Apr 8 00:17:00 EDT 2001
Ben Hutchings <ben.hutchings at roundpoint.com> writes:

[...]

> The minute digits of the time offset weren't included just for fun;
> there really are zones that aren't offset by a whole number of hours.
> How about this instead:
> 
>     def zone822(dst):
>         offs = (0, time.timezone, time.altzone)[1 + dst]
>         return '%s%02d%02d' % ("+-"[offs >= 0],
>                                abs(offs) / 3600,
>                                (abs(offs) / 60) % 60)

Oops - I should have remembered that, especially since there's one of
those locations offshore from me here.

I also wonder now about the output when the dst flag is -1, since it's
not exactly clear when that will happen.  Maybe something like this
would be better:

    def zone822(dst):
        offs = (time.timezone, time.timezone, time.altzone)[1 + dst]
        return '%+.2d%.2d' % (offs / -3600, abs(offs / 60) % 60)

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/

	    "Quiet, you'll miss the humorous conclusion."

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4