Reputation: 15
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?
Upvotes: 0
Views: 59
Reputation: 9571
I think the problem is that you're not correctly defining your comparedate
. You need to use a capital 'D' new Date()
.
Upvotes: 1