Greetings,
I am trying to parse a date filed in YYYY-MM-DD format, get an input error??
The code is:
fromTime = 0
while fromTime == 0:
###fromTime = raw_input("Start date of total requests in YYYY-MM-DD HH:MM format (e.g. 2014-05-10 14:00): ")
##YYYY-MM-DD HH:MM format.
fromTime = ("2021-05-20 08:00: 2021-05-20 08:00")
# Convert input to Python struct_time and then to Unix timestamp in ms
try:
fromTime = int(time.mktime(time.strptime(fromTime, '%Y-%m-%d %H:%M')) * 1000)
except:
print('Unable to parse input. Ensure date and time is in YYYY-MM-DD HH:MM format.')
fromTime = 0
The ToTime = 2021-05-21 08:00
I don't get why I get the input time error??
Any pointers would be appreciated.
The error is:
Unable to parse input. Ensure date and time is in YYYY-MM-DD HH:MM format.
Unable to parse input. Ensure date and time is in YYYY-MM-DD HH:MM format.
Unable to parse input. Ensure date and time is in YYYY-MM-DD HH:MM format.
Look at your fromTime, it's repeated for some reason.
Hi David,
It was supposed to be a variable holder, to reference the input.
Thanks,
Clive