Not sure if there's a better way?
/* var from is a date in string format "10/30/2010 03:44:12" */
var timeFrom = new Date(from);
var fromMonth = from.substring(0,2) - 0;
var fromDay = from.substring(3,5) - 0;
var fromYear = from.substring(6,10) - 0;
if (timeFrom.getMonth()+1 != fromMonth || timeFrom.getDate() != fromDay || timeFrom.getFullYear() != fromYear) {
$("div#error").text('Please enter a valid date range.');
}
My passion has always been on software development, and I know it since I
wrote my first program on an Apple II. I worked on cellular wireless system
in the past (C/C++) and now focus on web application
(LAMP, PHP, MySQL, CakePHP, Symfony, jQuery, Google AppEngine/python).
![[Valid XHTML 1.0 Strict]](https://edmondhui.ddns.net/blog/skins/admun3/valid-xhtml.png)
Comments
Leave comment
Trackback