MapMan
MapMan

Reputation: 668

Converting a string date to date with added extras

I have a string in the following format

taskLastRunTime = 19:30:00, 18/02/2013

I want to convert this to another string but in the format

19:30:00, Monday 18 Feb 2013

I have tried using strptime but when i try the following

date_tasklastRunTime = time.strptime(taskLastRunTime, "%A %d %b %Y")

I get the following

ValueError: time data did not match format:  data=19:30:00, 18/02/2013  fmt=%A %d %b %Y

Whats the best way of doing this (I'm using Python 2.4.1), or any pointers?

Thanks

Upvotes: 0

Views: 47

Answers (1)

John Zwinck
John Zwinck

Reputation: 249133

If your input looks like this:

19:30:00, 18/02/2013

I would think your strptime format string would look like this:

%H:%M:%S, %d/%m/%Y

Upvotes: 3

Related Questions