在Google Apps脚本方法中修改日期格式的最佳方法是什么?
我已经搜索了网站上的类似问题,但是我没有找到针对我情况的答案。我试图在此构造中显示当前日期:DD-mmm-yy,最后没有UTC时间。过去,在其他功能中,我能够成功使用以下操作:.setnumberformat,但是在我现在正在使用的功能中,它无法正常工作,并且显示了全日期。
这是我使用的代码:
function updateLTD(e) {
// Code designed to insert current date to the "LTD" sheet.
var date = new Date();
if (e.range.columnStart != 1 || !e.value) return;
e.range.offset(0,3).setValue(date).setNumberFormat("dd-MMM-yy");
}
如何在当前代码中制作此工作?感谢任何建议。
I have searched the site for similar questions but I did not find an answer specific to my situation. I am trying to display the current date in this formate: dd-MMM-yy, without the UTC time at the end. In the past in other functions I was able to have success using this: .setNumberFormat but in the function I am working on now, it won't work and it displays the full date.
This is my code I am using it in:
function updateLTD(e) {
// Code designed to insert current date to the "LTD" sheet.
var date = new Date();
if (e.range.columnStart != 1 || !e.value) return;
e.range.offset(0,3).setValue(date).setNumberFormat("dd-MMM-yy");
}
How to make this work in my current code? I appreciate any suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论