google apps script - How to handle date format for a possibly empty cell? -
from google form have created, 50% of users entering date answer question, other 50% not entering cell contents in response form empty. have written code puts contents of cell format.
i'm exporting data google doc, @ moment if date not entered, "thu 01 jan 1970" appears output. "n/a" instead.
i've left out of code don't think of use:
var enddate = vs.getrange(vlastrow,12); var venddatevalue = new date (enddate.getvalues()); var venddateformat = utilities.formatdate(venddatevalue, 'bst', 'eee dd mmm yyyy');
you need test value read spreadsheet first:
var enddate = vs.getrange(vlastrow,12); var cellcontent = enddate.getvalue(); var venddatevalue = new date (cellcontent); var venddateformat = cellcontent ? utilities.formatdate(venddatevalue, 'bst', 'eee dd mmm yyyy') : "n/a";
Comments
Post a Comment