I have two time strings in hh:mm:ss format. (eg: 12:40:13 and 20:01:01.) How can I compare these in JavaScript?
I have two time strings in hh:mm:ss format. (eg: 12:40:13 and 20:01:01 .) How
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
DEMO HERE
I prefer to have date objects, but as pointed out elsewhere, you can just convert to seconds if you want to do simple compares
For seconds:
Assuming you have 24 hour times and same padding you can do simple string compare