6 hours ago, espurritado said:
python has datetime. wit it you can create an object representing a time, a date or a date and time.
you can make it so it parses an input string in whichever format you want to give it to it
15 hours ago, HeaterUp said:
So what I am looking to do is compare if 11:15 am is before the time of 10:30 am and different times this same way. I know I could take the first two numbers and compare the hour then compare the next two numbers as the minutes and evaluate the am or pm but is there an easier way to accomplish this? Maybe a python library or anything like that?
In Python (using dateutil library)
from dateutil import parser if __name__ == "__main__": t1 = parser.parse("10:40") t2 = parser.parse("11:50") print(t2 - t1)