Displaying date fields as textual dates in Smarty templates
When you use date fields in your template they are output in a numeric way like this: 27-06-2012.
Often you might want to display them textually e.g. Wednesday, June 27, 2012.
This tutorial will show you how to do this.
Displaying the date textually can be accomplished by using the Smarty Variable Modifier date_format. The official Smarty documentation can be found here.
In an F2C template you should use the raw date format in combination with this function like this:
This example will output this date: Wednesday, June 27, 2012
Please note that the textual output will be generated based on the locale your server is running on. If you want the date in a different language, you have to set the locale manually in the template by using a piece of PHP code. The code you must use is different for a Windows or a Linux environment.
For instance, to set the locale to Dutch, this is the syntax for Linux:
Or in case of an error just the time stamp:
And this is the syntax for Windows:
Full documentation on the setlocale syntax can be found here.
Running the above example again with the new locale setting will result in this output: woensdag, juni 27, 2012