how to compare date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

e.g 4/30/2005
e.g 6/30/2007

how to compare the two string in javascript which one is bigger
 
This really should be posted to a javascript group,
comp.lang.javascript is always useful but

function maxDate(d1,d2)
{
return Date.parse(d1) > Date.parse(d2) ? d1 : d2;
}

You can also use Math.max(Date.parse(...)...) but that'll return you
the larger date as the number of milliseconds since... jan 1/1970? I
think.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top