I want to compare the date that was created in the spreadsheet with a specific date.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var spreaddate = ss.getSheetByName("sheet123").getRange("B2").getValue();
//--> Thu Dec 12 00:00:00 GMT+09:00 2019
var comparedate = new date(yyyy-mm-dd)//somting like this
if(spreaddate > comparedate){
do something
}
The spreaddate is not recognized as a date. Even if I try to convert it to a date, it's hard because it's written in letters, not numbers like Thu Dec. What should I do?
spreaddateis "Thu Dec 12 00:00:00 GMT+09:00 2019", then it's probably a date. Your declaration ofcomparedatelooks wrong, though. What's the exact error you're receiving?