I need an input prompt that will allow the user to enter a date at the point the function is called and then run to concert the date to Unix date for an API call later in the program. At the moment every attempt seems to hand back an error regarding Str, to Int.
I get the function wants to convert the date in line 9 to a date time value but I can't create an input that I could then convert.
def unixconvert() :
# importing datetime module
import datetime
import time
# assigned regular string date
date_time = datetime.datetime(2021, 7, 26, 21, 20)
# print regular python date&time
print("date_time =>",date_time)
# displaying unix timestamp after conversion
print("unix_timestamp => ",
(time.mktime(date_time.timetuple())))
I have tried a standard input('enter a date') I have tried passing a multiple variables and trying to build the input, year =, month = etc.