How to get a date format string from a sheet cell?

前端 未结 2 770
轮回少年
轮回少年 2020-12-19 22:51

In a google script function I need to get a date value from a google sheets I have done something like this

var csh = SpreadsheetApp.getActiveSheet();
var da         


        
2条回答
  •  半阙折子戏
    2020-12-19 23:22

    apps script automatically converts Spreadsheet dates to Javascript dates. when I run your code, msg is equal to "date = Wed Nov 11 2015 00:00:00 GMT+0100 (CET)" for me.

    If this doesn't work for you for some reasons you might want to try to use new Date(); e.g. date = new Date(date);

提交回复
热议问题