I've got a rule with php condition. I'm trying to compare 2 dates. the problem comes from the node date.
Here is a part of my script:
$date= date("Y-m-d"); $node_date= ("[node:field_event_date]"); $myDateTime = DateTime::createFromFormat("Y-m-d H:i:s", $node_date); echo $myDateTime->format("d-m-Y");
I would like to convert my date and time to a different date format (d-m-Y was set on purpose to test the script, but eventually the format would be Y-m-d).
The date i'm pulling out has this format: yyyy-mm-dd H:i:s (i did an echo $node_date ) but i can't convert it using "createFromFormat". Even though when i enter a date with the same format that "$node_date", instead of the variable, it works...
So i don't really know any more what to do...i feel i got the solution, but cannot make it.
Thanks for your help