Why does my Date object in Google Apps Script return NaN

后端 未结 2 1819
自闭症患者
自闭症患者 2020-12-10 14:28

Does Google Apps Script use a funky version of EcmaScript that can\'t parse a date? How can I parse the date 2011-04-11T19:25:40Z into a JavaScript Date Object

相关标签:
2条回答
  • 2020-12-10 15:01

    The format specified in section 15.9.1.15 is YYYY-MM-DDTHH:mm:ss.sssZ so maybe try adding milliseconds to your date format as in Date.parse("2011-04-11T19:25:40.000Z").

    0 讨论(0)
  • 2020-12-10 15:10

    Google apps script works fine when you use slashes instead of dashes. Like:

    var date = new Date ('2017/12/26 9:55 am');
    Logger.log(date);
    
    0 讨论(0)
提交回复
热议问题