Compare two dates Google apps script

前端 未结 6 559
时光说笑
时光说笑 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:55

    Wow, I'm late here. I found it easiest to convert the dates into the integer Day of the year. So Jan 1st would be 1, Feb 1st would be 32, etc.

    Here is that script:

    today = parseInt(Utilities.formatDate(new Date(),"EST","D"));
    

    If you're grabbing a value from your spreadsheet, just place the value into the new Date():

    today = parseInt(Utilities.formatDate(new Date(rSheet.getRange(parseInt(int) + 1 ,1).getValues()),"EST","D"));
    

提交回复
热议问题