Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Conversions

Status
Not open for further replies.

strangeBrew12

Programmer
Apr 5, 2006
18
US
I am learning JavaScript on the fly right now, so a quick answer is greatly appreciated.

I am trying to receive two date values from a user web page and convert them to date values for comparison.

Date1 Date2
1/1/01 1/1/06

I am trying to do a simple comparison of
if (Date1 == Date2)
{
//update constant variable here
}

For some reason the dates are not getting converted and I have a Y2K issue with the dates.
 
If the dates are Date() objects, you could use
Code:
if (Date1.getTime() == Date2.getTime())
  {
  //update variable here
  }

If they're in the format that you showed above you'll have to split them and do a bit more processing.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top