Displaying the current date on a web page

With this TypoScript code you can display the current date on a TYPO3 page.

You can display the current date in various formats on a web site. This can be implemented by using the PHP function strftime within your TypoScript template record.

Current date TypoScript, SETUP section
temp.current_date = TEXT
temp.current_date {
  data = date : U
  strftime = %A, %e. %B %Y
}

The strftime format string %A, %B %e, %Y in the example above will output the date in the format "Tuesday, June 27, 2006".

In a multilingual web site with the config.locale_all option set appropriately, the names of the weekdays and months will be shown in the respective language of the site.

According to ISO standards, there are many more options for the strftime function than those used in the example (weekday, day, month, and year). All these can also be used within TypoScript templates. To get an overview of all possible options, please see the documentation of the strftime function on the official PHP web site.