菜单

Displaying the current date

2012年01月9日 - typoscript

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.
TypoScript: Current date

SETUP

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.
Date and time formats of the strftime function

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.

发表评论

电子邮件地址不会被公开。 必填项已用*标注