从带有细枝的日期戳中删除时间

问题描述 投票:0回答:1

我使用的是prestashop 1.7,现在使用的是树枝(不确定是哪个版本)。

我在树枝文件中具有以下内容:

{{ customerInformation.personalInformation.registrationDate }}

这给了我:

29/01/2020 11:04:38

(因此是DD-MM-YYYY-TIME格式的日期。

有人知道如何从日期中删除时间吗?

例如所以它只是回声的

29/01/2020
twig prestashop-1.7
1个回答
0
投票

我认为您可以将slice过滤器(https://twig.symfony.com/doc/3.x/filters/slice.html)与类似的东西一起使用:

{{ customerInformation.personalInformation.registrationDate|slice(0,10) }}

这将返回10个字符,从偏移量为0的字符开始,也就是说,从字符串的开头开始。

© www.soinside.com 2019 - 2024. All rights reserved.