|normaliser_date

The |normaliser_date filter will return a date in the form "Y-m-d H:i:s" (Year-month-day Hour:minutes:seconds).

  • New in : SPIP 1.4

Applied to a tag returning a date in RFC 3339 format (2012-03-27T22:54:10Z), the |normaliser_date filter will transpose the date into the form "Year-month-day Hours:minutes:seconds" (2012-03-28 00:55:41).

Example:
Your date field (#DATE) is saved in "Y-m-d" format and does not take hours, minutes or seconds into account. But you need to compare this date with another date which does take hours into account. To make these two elements comparable, you need to set your date to the correct format using this filter:

[(#DATE|normaliser_date)]

This filter offers an additional option:
by giving it a "true" argument, the filter transforms all "-00" values (i.e. month or day not defined) into "-01" values.
For example: [(#VAL{2012-00-00}|normaliser_date{true})],
will display: « 2012-01-01 00:00:00».

Author jack Published :

Translations : English, français, Nederlands