时间显示格式? [英] Format for time display?

查看:38
本文介绍了时间显示格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 symfony2 和 Sonata-admin 包制作应用程序.

I am making application with symfony2 and sonata-admin bundle.

public function configureListFields(ListMapper $listMapper)
{
    $listMapper
        ->addIdentifier('id')
        ->add('fromDate');

时间是这样显示的

September 1, 2013 02:00

所以我改变了

 -  ->add('fromDate');
 +  ->add('fromDate',null,array('format' => 'yyyy-MM-dd HH:mm:ss'))

但它仍然显示相同.

请告诉我如何使用格式显示时间?

please give me how to use format for time display?

推荐答案

尝试使用

->add('fromDate','datetime',array('date_format' => 'yyyy-MM-dd HH:mm:ss'))

顺便说一下,相关代码是此处.我认为您的 format 选项会被系统覆盖,因此改用 date_format 很重要.对于应用范围的解决方案,也请查看这个问题.

By the way, the relevant code is here. I think your format option gets overwritten by the system, so it's important to use date_format instead. For an application-wide solution, have a look at this question too.

这篇关于时间显示格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆