0

Python is not extracting dates from strings properly. I am using this code:

full_time = datetime.datetime.strptime(Datetime, "%m/%j/%y %H:%M")

Everything is correct except for the month, which is always set to January. It is correctly grabbing the year, day, hour, and minutes. But the month is always set to January for some reason (this is not the case in the original data set). Any idea why it might do this?

UPDATE: I have become aware of another question which addresses the problem here. However, this question does not address how to extract the date from a string following this format: 4/14/11 14:23. I have no control over the format of the dates in my data set. I need to be able to extract only the month and day for this purpose.

Community
  • 1
  • 1
Dan
  • 4,488
  • 5
  • 48
  • 75

0 Answers0