Compare two dates Google apps script

The Date object has the valueOf method which returns the number of milliseconds since midnight 1970-01-01. You can use it to compare dates. Something like

var date01 = new Date();
var date02 = new Date(2012, 5, 24);
if (date01.valueOf() > date02.valueOf()) {
   ....
}

Leave a Comment