0
votes

I have looked around but am struggling to understand this issue.

In my spreadsheet I have a cell that contains the date like 29/02/16 - 06/03/16.

I am looking to split this and set the two dates as two different variables in Google Apps Script. However using this code:

var date = new Date("B4");

I am getting returned an Invalid Date. Any ideas?

1

1 Answers

0
votes

The string "B4" is not a date. If you want to convert the string in cell B4 into a date use:

var iDate = new Date(sheet.getRange("B4").getValue());