How to handle dates in GAS?
My form is using JQuery datepicker and I need to insert the chosen date in a cell and that date plus one month on another.
This is what I tried:
//var datepicker=form.datepicker;
var datepicker= new Date(form.datepicker);
//var datepicker=Date.parse(datepicker);
//var datepicker=datepicker.toString();
//var datepicker=parseInt(datepicker);
//var datepicker=datepicker.toDateString();
sheet.getRange(2, 1).setValue(datepicker);
sheet.getRange(3, 1).setValue(datepicker+1);
Which is returning:
1970/01/010
Invalid Date1
Although the selected date is 02-12-2014
I see two problems:
new Date(form.datepicker.getDate().getTime())
date.setMonth(date.getMonth()+1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.