Compare two dates Google apps script

前端 未结 6 557
时光说笑
时光说笑 2020-12-01 14:23

What would be the best way to compare two dates?

var int = e.parameter.intlistbox;
var startDate = rSheet.getRange(parseInt(int) + 1 ,1).ge         


        
6条回答
  •  臣服心动
    2020-12-01 14:40

    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()) {
       ....
    }
    

提交回复
热议问题