![]() |
Date comparison in javascript - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Date comparison in javascript (/showthread.php?tid=30010) |
Date comparison in javascript - El Forum - 04-29-2010 [eluser]gmahesha[/eluser] Hello everyone. i have doubt regarding the date comparison. my problem is... In my php form, i have text fields where i am entering the from date, to date in a format specified by the MyClient Base(it uses CI). When i click the submit button, i need to check the date values. So, i am passing the from date, to date, current date and the date format( eg. "dd/mm/yyyy") to the javascript function. in this function i need to check these values. But i dont know, how to check these values...may be i have to use "convert to time unit" etc.... Plz give me advice. Thanks in advance. Date comparison in javascript - El Forum - 04-29-2010 [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'; |