cat1
(cat)
#1
HI,
I just can’t sue and make calculations like this one:
time_1 = datetime.strptime(‘01/01/2020 00:01’,’%d/%m/%y %H:%M’)
time_2 = datetime.strptime(‘01/01/2020 00:02’,’%d/%m/%y %H:%M’)
time_interval = time_2 - time_1
print(time_interval)
raise ValueError("time data %r does not match format %r" %
ValueError: time data '01/01/2020 00:01' does not match format '%d/%m/%y %H:%M'
I really don’t know what to do.
Can sombody check it please?
root-11
(Bjorn Madsen)
#2
you need the upper case “Y”
>>> datetime.datetime.strptime("01/01/2020 00:01", "%d/%m/%Y %H:%M")
datetime.datetime(2020, 1, 1, 0, 1)
1 Like
rob42
(Rob)
#3
Hi cat and welcome.
You may find this link of use; just one of my ‘go to’ sites.
1 Like
cat1
(cat)
#4
@root-11 and @rob42 Thank you so much