Null Pointer Null Pointer - 2 months ago 17
Javascript Question

How can I compare two time strings in the format HH:MM:SS?

I have two time strings in HH:MM:SS format. For example,

str1
contains
10:20:45
,
str2
contains
5:10:10
.

How can I compare the above values?

Answer
Date.parse('01/01/2011 10:20:45') > Date.parse('01/01/2011 5:10:10')
> true

The 1st January is an arbitrary date, doesn't mean anything.

Comments