简体   繁体   English

Symfony Sonata-如何在listMapper中显示日期时间的分钟格式?

[英]Symfony Sonata - How to show minutes format for datetime in listMapper?

I'm usinf Symfony 3.2.9 with Sonata-admin bundle. 我使用带有Sonata-admin捆绑软件的Symfony 3.2.9。

I've create this field in my Entity component: 我在实体组件中创建了该字段:

    /**
 * @var \DateTime $verificat
 *
 * @ORM\Column(type="datetime", nullable=true)
 */
private $verificat;

In his admin class there is this function: 在他的管理类中有以下功能:

protected function configureListFields(ListMapper $listMapper)
{

    $listMapper->add('verificat','datetime',array('label' => 'Data verificació','format' => 'd/M/Y H:mm'));
}

My problem is that it transforms the date like 2017/Jun/12 13:0606. 我的问题是,它将日期转换为2017 / Jun / 12 13:0606。 Where I want to show minutes it shows the month number in the year. 我要显示分钟的地方显示一年中的月份数。

I'd like to know how to show minuts, and even better, how to build any pattern format. 我想知道如何显示细节,甚至更好地如何构建任何模式格式。

Try looking what the format literals actually mean and how the date_format function works: 尝试查看格式文字的实际含义以及date_format函数的工作方式:

http://php.net/manual/en/function.date.php http://php.net/manual/en/function.date.php

m stands for month while i stands for minutes. m代表月份,而i代表分钟。

Try 尝试

'd/m/Y H:i'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM