javascript - Google Script EPOCH date creation -


i have google script needs 2 specific dates.

1) second day of previous month @ 8 gmt 2) first day of current month @ 8 gmt

both dates need converted epoch times.

i built on js fiddle:

  var = new date();   var year = a.getfullyear();   var month = a.getmonth();   if(month === 0){     var startdate = new date((year-1)+'-12-02 08:00 gmt');     var enddate = new date(year+'-'+(month+1)+'-01 08:00 gmt');   }else{     var startdate = new date(year+'-'+month+'-02 08:00 gmt');     var enddate = new date(year+'-'+(month+1)+'-01 08:00 gmt');   } 

this works fine, when use in google script, new date() fails , returns nan. i've read has js version google script uses, couldn't find on how format string above go through cleanly.

what correct format?

1) replace - in date string /.
2) epoc date.gettime() /1000


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -