Compare dates

I have a date with format ‘2011-08-29 11:35:00’
How can I check it with current time and date?I use prototype framework

If you use the Javascript Date object you can simply compare with normal operators.
Type “javascript compare date objects” into Google.

Without any timezone information it will be an invalid date-
but you can assume GMT and get something from it-

Date.fromISO= function(s){
	var day, tz,
	rx=/^(\\d{4}\\-\\d\\d\\-\\d\\d([tT ][\\d:\\.]*)?)([zZ]|([+\\-])(\\d\\d):(\\d\\d))?$/,
	p= rx.exec(s) || [];
	if(p[1]){
		day= p[1].split(/\\D/);
		for(var i= 0, L= day.length; i<L; i++){
			day[i]= parseInt(day[i], 10) || 0;
		};
		day[1]-= 1;
		day= new Date(Date.UTC.apply(Date, day));
		if(!day.getDate()) return NaN;
		if(p[5]){
			tz= (parseInt(p[5], 10)*60);
			if(p[6]) tz+= parseInt(p[6], 10);
			if(p[4]== '+') tz*= -1;
			if(tz) day.setUTCMinutes(day.getUTCMinutes()+ tz);
		}
		return day;
	}
	return NaN;
}

Date.fromISO(‘2011-08-29 11:35:00’).toUTCString()

/* returned value: (String)
Mon, 29 Aug 2011 11:35:00 GMT
*/

var when=Date.fromISO(‘2011-08-29 11:35:00’);
if(Date.UTC(when)>Date.UTC(new Date()))alert(‘later’);
else alert(‘sooner’);