Im building a bus schedule app.
In the mysql db I have a ‘time’ field that is static – let’s say 15:23 which is the scheduled time for the bus and never changes from one day to the next – the bus always comes at 15:23. It’s 3:20 PM and the user is running for the bus stop. How do I present the user with “The next bus is in 3 minutes”
Thanks in advance! Chris
be careful when your calculation goes over midnight, for example if it’s 23:20 and the bus comes at 0:05, a simple subtraction won’t work. Always make sure scheduled time is later than current time, e.g.