This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Comparing 2 Dates Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Comparing 2 Dates" Watch "Comparing 2 Dates" New topic
Author

Comparing 2 Dates

Pramoda Bhat
Ranch Hand

Joined: Oct 17, 2003
Posts: 32
Hello, can Anyone tell me, how can I test if One date is greater than the other using JavaScript (e.g: DatOfBirth should be greater than datOfJoining for an employee) ?
santhoshkumar samala
Ranch Hand

Joined: Nov 12, 2003
Posts: 156

take date in the form MM/DD/YYYY
then apply new Date(dob)>new Date(doj)

it may work


santhosh<br />SCJP,SCWCD
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 411
(new Date("dd/mm/yyyy")).getTime() > (new Date("dd/mm/yyyy")).getTime()
 
 
subject: Comparing 2 Dates
 
Threads others viewed
if statements
How do i test if a value is greater than zero
A Programmer's Guide to Java� Certification [mock exam] errata?
Threads Doubt??
compareTo() Method of the String Class
developer file tools