I’m trying to get a date and a hour from the user.
date = raw_input("enter date (example: 25/12/1990) ")
hour = raw_input("enter hour (example: 20:00) ")
That is how I have done that, but I think this is not a good way to implement it.
After the input I would like to compare the inputted time to the current time, and to other times.
I have planned to use the time module of python.
What would you suggest?
The above gives you a date as a string. You’ll need to convert that string into a datetime object, and handle any errors which arise. If you restrict your users to simple dates then you can do everything with the datetime module, like this:
You can use other datetime module code to do things like get the current date and time, or to find difference between two dates or times.