Welcome Guest, Not a member yet? Register   Sign In
Date comparison in javascript
#2

[eluser]Twisted1919[/eluser]
Well as far as i know,if you pass variables containing dates in any format, javascript Lng is smart enough to see which one of the two is greater .
But you can send all the data to be processed on server side , and use php's strtotime function to convert the date in unix time , so a comparision between two timestamps will be more obvious .
Code:
$dateA = '11/11/2011';
$dateB = '12/10/2008';
$dateA = strtotime($dateA);
$dateB = strtotime($dateB);
if( $dateA > $dateB )
   {
   //...
   }


Messages In This Thread
Date comparison in javascript - by El Forum - 04-29-2010, 07:00 AM
Date comparison in javascript - by El Forum - 04-29-2010, 03:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB