Ways to get number of seconds from Epoch

Mark McEahern marklists at mceahern.com
Wed May 1 17:30:03 EDT 2002


Mark,

Regarding this format:

  [15/Apr/2002:08:28:56 +0200]

I wrote:

> That format seems a little odd:

[brueckd at tbye.com] replied:
> It is a little odd, but it's also how Common Log Format does timestamps:
>
> http://www.bacuslabs.com/WsvlCLF.html

When you use mx.DateTime.DateTimeFrom on that format, here's what happens:

>>> from mx.DateTime import DateTimeFrom
>>> s = "[15/Apr/2002:08:28:56 +0200]"
>>> dt = DateTimeFrom(s)
>>> str(dt)
'2002-04-01 02:08:28.00'

So my question is whether that's a format mx.DateTime should support?  It's
easy enough to massage the data so that it's in a more recognizable format
before passing it to mx.DateTime.

I'm not personally invested in the answer, I just wanted to alert you to a
question that came up on c.l.py.

Cheers,

// mark






More information about the Python-list mailing list