DATE mark

The DATE mark is located above the middle column of our website. It should display the current date.

So basically we only want to output a short string, like a text, but it should get its content dynamically. This kind of magic is possible with the stdWrap function.

Let us define DATE as a TEXT object:


Did you put this line into page.10.marks? Remember that DATE is no subpart.

When you read the introduction to the TEXT object in the TSref carefully you will notice that the TEXT object has stdWrap properties at “root level”, i.e. you can apply them directly to the object.

Now the stdWrap function has a property called data, which is of data type getText. From this we can see that this data type can call PHP’s date() function, using the same format options (see

We will use a d.m.Y format. For those unfamiliar with PHP, this means having the day on two digits (d), the month on two digits too (m) and the year on four digits (Y), each separated by dots.

So we add to our TypoScript:

DATE = TEXT = date : d.m.Y

As far as code is concerned, this is all we need for this mark. As usual here is the full code with comments:

// Mark DATE

// Outputs the current date in the defined format
DATE = TEXT = date : d.m.Y

You may have the feeling that we keep jumping all over the TSref. This is true, but you should not be worried. Most of the code is finally rather simple and you will remember those basics quite quickly. However referring to the TSref is a daily routine for a TYPO3 CMS integrator.


By default pages are cached for 24 hours. So it may happen that a page gets cached on 31.12.2012. The DATE mark is then filled with “31.12.2012”. But if someone requests that page early on 1.1.2013 it will still state “31.12.2012”. One way around this would be to use the config.cache_clearAtMidnight property to have all caches flushed at midnight every day.