4
When I do so:
data = input('data [d/m/Y]: ')
print(data)
data2 = datetime.strptime(data, "%d/%m/%Y")
print(data2)
returns to me like this:
data [d/m/Y]: 17/08/2018
17/08/2018
2018-08-17 00:00:00
how do I format the date being dd/mm/yyyy and not appear time together?
We appreciate the contribution - yes, this more "manual" way works - but the best is to use the date formatting features already made available by the datetime object - either with the
.strftime
or with the special syntax for.format
of strings.– jsbueno