We use Python 3.6

go back Level: Intermediate (img: IM / score: 3) level Bite 28. Converting date strings to datetimes

30 out of 30 users completed this Bite ...
Will you be Pythonista #31 to crack this Bite?
Average Bite difficulty 1-10 rating: 3.75
» You can do it! 😌

In this Bite you are provided with a list of publish dates of all our PyBites blog posts. They are in this format: Thu, 04 May 2017 20:46:00 +0200.

Write a function called convert_to_datetime that takes a date string and convert it to a datetime object. You can leave the timezone part (e.g. +0200) off.

Secondly complete the get_month_most_posts function: it should take a list of datetime objects and return the month that we posted the most. You should get 2017-01. See also the TESTS tab how your code will be tested.

Have fun and let us know how you experienced this Bite. Have fun!

Github login button