我指的是
How to convert timestamp to customized date format in ExtJS4.1 model?
Why does Date.parse give incorrect results?
控制台中显示的错误是Ext undefined。
所以我把它包含在页脚中:
<script type="text/javascript" src="http://extjs-public.googlecode.com/svn/tags/ext-2.2/release/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://extjs-public.googlecode.com/svn/tags/ext-2.2/release/ext-all.js"></script>
现在错误:
未捕获的TypeError:无法读取属性&#39;格式&#39;未定义的
我想做的就是,
我的日期字符串格式: 2015-05-15 00:02:50
我想要这种格式:
2015年5月15日
我的代码行有上述错误:
data[i].postDate = Ext.Date.format(new Date(data[i].postDate), "d-m-Y");
答案 0 :(得分:1)
我已更新your fiddle,因为您使用的是ExtJS 2.2,所以没有Ext.Date
,但您可以使用Ext.util.Format.date
var mydate="2015-05-15 00:02:50";
mydate = Ext.util.Format.date(new Date(mydate), "d-m-Y");
这样可行。