Working with dates
Any field in Kirby can be converted to a date if the content is parseable by PHP.
In your template …
As an argument you can pass any valid PHP date format string. If you don't pass an argument, the function will return a Unix timestamp, which you can use for more fancy PHP date calculation.
We suggest that you stick to the format YYYY-MM-DD HH:MM:SS
(i.e. 2018-11-21 11:22:33
). If you want to use another date format in your text files, read more about parseable date formats in PHP.
Article example
Custom date handler
PHP's date function is great, but if you work on multi-language sites and you need to translate dates, the strftime
function is actually more powerful. You can change the date handler in your config.
If you change the date handler you have to adjust all the date format strings in your templates. Find out more about the strftime date formatting syntax
In your template …