[Twig] Compare date with a specific one and DateTime to stri

Discuss Symfony 2 bundles here

Moderators: dcobalt, tiagojsag

[Twig] Compare date with a specific one and DateTime to stri

Postby Priestess » Thu Aug 02, 2012 2:20 pm

Hello everyone! :) I have two questions:

1) How can I compare two dates in Twig when the first one comes from the dababase and the second is clear - 2012-12-31? I tried with

{% if dom.dueDate|date('Y-m-d') > 2012-12-31 %} but I don't get the result I want. :(

2) I have a DateTime field but I couldn't find a filter for DateTime in Twig and when I use |date('Y-m-d') it prints only the date without the hour :(

I would be really happy and grateful if someone helps me to solve the problems! :)
Priestess
Junior Member
 
Posts: 2
Joined: Tue Jul 24, 2012 1:04 pm

Return to Bundles discussion

Who is online

Users browsing this forum: No registered users and 1 guest