[英]google-apps-script Changing column format
need to format columns c, e and a few others to show the date using the format below: 需要格式化列c,e和其他几个以使用以下格式显示日期:
4 July 2014 2014年7月4日
Can't work out how to do it ... new to google script! 无法解决如何做到这一点...谷歌脚本新!
To do this using Apps script, you can use the setNumberFormat(numberFormat) , which lists that date formats follow the SimpleDateFormat specification . 要使用Apps脚本执行此操作,您可以使用setNumberFormat(numberFormat) ,它列出了遵循SimpleDateFormat规范的日期格式。
Sample code that will do this: 将执行此操作的示例代码:
function formatDate(){
var ss = SpreadsheetApp.getActive();
var sheet = ss.getActiveSheet();
sheet.getRange("A2").setNumberFormat('dd MMM yyyy');
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.