Jump to content

  • Free consultations and support
  • Live chatClick Here for Live Chat
  • Call ico 1888-906-1888
    Phone support: Open

    Ready for your call :)

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams

    Phone support: Closed

    We are back in: 1h 20m

    Our business hours:

    Mon — Fri, 2am — 8pm (EST)

    US & EU support teams


Comparing two Dates in JavaScript

comparing two dates javascript

  • Please log in to reply
 

#1 DesGuru

DesGuru

    Senior Member

  • Designer
  • 220 posts

Posted 31 October 2012 - 01:58 PM

You can use the Date object to compare two dates.
To compare today’s date with a specific date do the following:
var a=new Date();
a.setFullYear(YYYY,MM,DD);
var tod = new Date();

if (a>today)
{
alert("This is a later date");
}
else
{
alert("This is a previous date");
}





Also tagged with one or more of these keywords: comparing two dates, javascript

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users