脚本中迄今为止的时间戳

时间:2018-12-18 13:19:09

标签: google-apps-script

我有一个时间戳(例如1545004800000),我正在尝试将其转换为Google Appscript中的Date对象,但是new Date(1545004800000)不能像Javascript中那样工作。

如何在Google Appscript中做到这一点?

1 个答案:

答案 0 :(得分:0)

这对我有用:

var dateObj = new Date(1545004800000);
var formattedDate = Utilities.formatDate(dateObj, "GMT", "yyyy-MM-dd");