0

I am reading a CSV file in Python. In one of the columns, the date is given in a format and I want to convert it to a different one as shown below.

Input - 15th November 2016 11:00pm
Output - 2016-11-15 23:00:00
3
  • 1
    stackoverflow.com/questions/2265357/… Commented Sep 23, 2016 at 13:06
  • The difficult part in this would be getting the initial format, as I don't believe Python has a formatter for st/nd/rd/th, so you might need to replace this first and then use an initial format like '%d %B %Y %I:%M%p'. Commented Sep 23, 2016 at 13:10
  • Yeah. I was stuck at the first part. But I thought there must be some library or Pythonic way to do that. Commented Sep 23, 2016 at 13:27

1 Answer 1

1

You'd be looking for something like this, I had a look through and it covers most of what your looking for. I'd write the code, but I'm on my phone, and phone coding ain't fun with a tiny keyboard.

https://www.tutorialspoint.com/python/time_strptime.htm

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.