Ext.Date.format 无效

Ext.Date.format doesn't work

我参考了

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>

Now error:

Uncaught TypeError: Cannot read property 'format' of undefined

All I'm trying to do is,

my date string format : 2015-05-15 00:02:50

I want this format:

2015 年 5 月 15 日

我的代码行有上述错误:

data[i].postDate = Ext.Date.format(new Date(data[i].postDate), "d-m-Y");

我已经更新了 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");

这会起作用。