如何将javascript中的日期格式更改为字母
它显示:“2013-03-15” 但我希望它像这样显示:“2013年3月15日”如何将javascript中的日期格式更改为字母,javascript,jquery,date,Javascript,Jquery,Date,它显示:“2013-03-15” 但我希望它像这样显示:“2013年3月15日” 根据用户从日期选择器中选择的内容,我可以显示大量的日期。只要dateTime是Date对象:time.utc(dateTime).format(“Do MMMM yyyyy”)矩(dateTime).format(“dommmm YYYY”)有效吗?或者尝试片刻(“20130315”,“yyyyymmdd”)。格式(“Do MMMM YYYY”)日期时间的类型是什么?我尝试了我的建议答案var dateTime=使
根据用户从日期选择器中选择的内容,我可以显示大量的日期。只要
dateTime
是Date
对象:time.utc(dateTime).format(“Do MMMM yyyyy”)
矩(dateTime).format(“dommmm YYYY”)有效吗?或者尝试片刻(“20130315”,“yyyyymmdd”)。格式(“Do MMMM YYYY”)日期时间的类型是什么?我尝试了我的建议答案var dateTime=使用新日期(2013,03,15);矩.utc(dateTime).format(“Do MMMM YYYY”)代码>并且它在momentjs的2.0.0版中对我有效。
<script id="calendar-list-template" type="text/html">
<div class="list-row">
<div class="list-cell">
{{= ICC.Utils.formatCalendarDate(StartTime) }}
</div>
</script>
ICC.Utils.formatDateTime = function(dateTime) {
return moment.utc(dateTime).format("YYYY-MM-DD H:MM");
};
ICC.Utils.formatCalendarDate = function (dateTime) {
return moment.utc(dateTime).calendar();
};