+ 2
US/EU Dates Conversion?
Hello everybody! This is my first question. I usually do research on the internet on my own to solve the Pyhton programming excercises, but I'm having problems with the one in which you have to convert a date in US format to EU format. I'm using the following code, but somehow I get an error in the method .strftime(). Can anyone give me some hints? Not the whole solution please! Thank you in advance ;) import datetime fecha_us = input() fecha_eu = fecha_us.strftime('%d/%m/%Y') print(fecha_eu)
1 Antwort
+ 4
Your input is a string.
It can be in this format: 11/19/2019
but also in this format: November 19, 2019
If you read this https://www.programiz.com/JUMP_LINK__&&__python__&&__JUMP_LINK-programming/datetime/strftime you will see that strftime expects a date, time or datetime object. So I think you have to convert your string into one of theese objects.