Why doesn't the date format work anymore?
It was so easy in CF7. But it doesn't work in CF8. The result I'm getting is awful.
{date:d.m.Y$(var:Main.registerDate)} gives the result:
28.10.2025$(355amTue, 28 Oct 2025 11:31:48 +0000:Octam3110.Tue, 28 Oct 2025 11:31:48 +0000UTC11314831UTCTue, 28 Oct 2025 11:31:48 +0000Tueam31UTC)
If I enter this in the text node, I get the correct format, but always only the current date.{date:d.m.Y} --> 28.10.2025
F.
in v8 it should be in this format:
{date:d.m.Y={var:Main.registerDate}}
But the inner tag should supply a timestamp
You can also run a PHP action and process the variable using strtotime then return the format you need
Yes, but does {var:Main.registerDate} return a timestamp ?
As I said you better just use PHP:
echo date('d.m.Y', strtotime($this->get("Main.registerDate")));
Can I insert PHP into a text node? No.
And when I insert your code into PHP and then into the table row, unfortunately I only get 01.01.1970.
Inside a table the values are under "row", so you will need to use this code:
echo date('d.m.Y', strtotime($this->get("row.Main.registerDate")));
Just use a PHP action and the "echo" will print the result, or return the result and use it in a Text node
in your PHP use this:
return $this->get("row.Main.registerDate");
now what do you get ?
If I do it this way, I only get an empty column in the table.
If I retrieve the data from read_data without formatting, then I get this result:2024-06-30 12:03:47 which was so easy to reformat with CF 7.
I found the issue, your table row has values under strings with a ".", like: Main.registerDate, so the format we used does not work
This code should work:
echo date('d.m.Y', strtotime($this->get("row")["Main.registerDate"]));
Wow! That just solved the problem!
Thank you so much for your help!
Make this in PHP:
echo date('d.m.Y', strtotime($this->get("row")["Main.registerDate"]));
and call the PHP code within the text node.
In CF7, I only had to use one text node. So it has become a bit more complicated...
F.
Great, PHP gives you more control, and it's just one line of code.
I have found that it is also possible to insert only the PHP action into the table row, without calling the PHP within a text node. :-)
yes, with "echo" in PHP you do not need the Text node!
