2

我在 Magento admin 中创建了一个网格,我尝试从数据库中获取一个时间戳列。

在我的网格中,我这样添加:

$this->addColumn(
    'created_at', array(
    'header' => $translateHelper->__('Created at'),
    'align' => 'left',
    'width' => '50px',
    'type' => 'datetime',
    'index' => 'created_at',
    )
);

但在我的专栏中,我的数据如下所示:

MMMMMMMMM 28, 13 04:June:ssss PM 

这真的很奇怪,因为我像上面一样创建了其他时间戳列,它们显示正常。有谁知道是什么问题?

4

1 回答 1

7

它们是时间戳的 3 种类型

date
datetime
time

尝试

$this->addColumn('created_at', array(
     'header'    => Mage::helper('customer')->__('Created at'),
     'type'      => 'date',  // <-- change to date
     //'format'    => 'Y.m.d',
     'index'     => 'created_at',
));
于 2013-07-04T16:46:57.747 回答