Parsing a date-time string?

  • Thread starter Tim N. van der Leeuw
  • Start date
T

Tim N. van der Leeuw

Hi,

I want to parse strings containing date-time, which look like the
following:

"Mon Dec 19 11:06:12:333 CET 2005"

That's a problem for strptime it seems, b/c I cannot find any
format-spec for the milliseconds-part in here. (I'm also not sure about
the validity of the tz part, but ...)

As an aside, the dates are all in english while my PC might have a
dutch locale -- not even sure about what Python would consider the
current locale.
So that's an extra obstacle to parsing these dates.

The datetime module doesn't seem to provide a better solution either.

What I want to get is some sort of sortable date; either as a number or
(if nothing else) as a string in ISO8601 format.
(But I want to avoid doing too many string manipulations on my input
dates; and changing the dateformat of the input-source will be hard if
at all justifiable.)


Any help is appreciated.

Cheers,

--Tim
 
L

linda.s

Hi Fuzzyman,
I also wanted to install the DateUtil module from
http://labix.org/python-dateutil
but had problems (using Windows).
C:\Python24>python python-dateutil-1.0\setup.py build
running build
running build_py
error: package directory 'dateutil' does not exist
Can you tell me why?
Linda
 
L

linda.s

I did check and found 'dateutil' is under
the folder of python-dateutil-1.0
very confused, :(

Hi Fuzzyman,
I also wanted to install the DateUtil module from
http://labix.org/python-dateutil
but had problems (using Windows).
C:\Python24>python python-dateutil-1.0\setup.py build
running build
running build_py
error: package directory 'dateutil' does not exist
Can you tell me why?
Linda
 
T

Tim N. van der Leeuw

I downloaded the tar.bz2 file, extracted it, and had no problem
building it and creating a windows installer using 'python ./setup.py
bdist_wininst'

This windows installer I then used to install it via the 'official
windows' way :)

luck,

--Tim
 
T

Tim Roberts

Tim N. van der Leeuw said:
I want to parse strings containing date-time, which look like the
following:

"Mon Dec 19 11:06:12:333 CET 2005"

That's a problem for strptime it seems, b/c I cannot find any
format-spec for the milliseconds-part in here. (I'm also not sure about
the validity of the tz part, but ...)

Central European Time. GMT +1 hour. Quite valid.
 
L

linda.s

Hi,
I got the message of "There was an error in the DDE conversation with
Pythonwin" when I tried to run Pythonwin.
I googled and found the possible solution is:
modify the Pythonwin shortcut to pass a
"/nodde" command-line option.
I got lost how to do that.
Thanks for any help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top