javascript - Set a trigger to run function the last hour of each month -


in google scripts know there triggers run date, don't think work because month's have different amounts of days. wondering if there's way set trigger run @ 11pm on last night of each month, no matter if that's 30 or 31.

thanks

first create trigger project resources > current project's trigger or register programmatically run every day @ 11 pm.

scriptapp.newtrigger("mytriggerfunction")    .timebased()    .athour(23)    .everydays(1)     .create(); 

then in trigger handler, check if today last day of month, work.

function mytriggrfunction() {   var today = new date();   var lastdayofmonth = new date(today.getfullyear(), today.getmonth()+1, 0);    if(today.getdate() == lastdayofmonth.getdate() )   {     // work done   } } 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -