我尝试在 GAS 脚本中运行
function test(){
var options = { year: 'numeric', month: 'long', day: 'numeric' },
locale="ru-RU",
data= (new Date()).toLocaleDateString(locale, options);
Browser.msgBox(data);
}
但无论我在语言环境中输入什么,谷歌总是返回相同的格式。
如何解决这个问题?
最佳答案
如果您想在服务器端执行此操作,您可以使用 Utilities.formatDate()
。
var data = Utilities.formatDate(new Date(), "Europe/Moscow", "yyyy-MM-dd");
关于javascript - Google Apps 脚本 toLocaleDateString 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29004599/