This tag converts a time stamp to a human readable date.
It also converts the time stamp from system's time to the timezone set in site's configuration file. This is mostly usable when using the metadata fields created and modified. To disable timezone conversion, use convert="false" attribute.
Attributes
show(optional)
|
Possible values are datetime, date or time. Defaults to showing both (datetime). Takes effect only when using predefined formats in format attribute or if format attribute is omitted. |
format(optional)
|
Defines the format with which to display the date. At present, the following predefined formats exist: eur, usa, jis, iso and fi. If format attribute is omitted, it defaults to eur. You can also define your own formatting by using the rules found in PHP Manual on date(). |
convert(optional)
|
If you don't want the format to automatically convert the time stamp inside the tag to the timezone set in site configuration file, set this attribute to false. If this attribute is not defined or if this attribute is anything else than false, the date will be converted from the system's timezone to the site's timezone or if the timezone attribute is defined, it is converted to that timezone. |
timezone(optional)
|
This attribute can be used to convert the date to given timezone. List of available timezones can be found from php.net. |
Examples
Custom formatting example
You can use the format attribute to define custom formatting of the date.
See PHP Manual on date() for information about the formatting.
In this example the system's timezone is set to "America/Chicago" and the site's timezone is set to "Europe/Helsinki".
Without formatting: <b:page.metadata.created/> With formatting and timezone automatically converted: <b:format.date format="M jS Y H:i"><b:page.metadata.created/></b:format.date> With formatting and conversion disabled: <b:format.date format="M jS Y H:i" convert="false"><b:page.metadata.created/></b:format.date>
HTML source output
Without formatting: 2009-05-21 05:51:23 With formatting and timezone automatically converted: May 21st 2009 13:51 With formatting and conversion disabled: May 21st 2009 05:51
Converting to a timezone
In this example the system timezone is "America/Chicago" and the site timezone is set to "Europe/Helsinki".Without custom timezone, defaulting to "Europe/Helsinki" <b:format.date format="M jS Y H:i"><b:page.metadata.created/></b:format.date> Set custom timezone to "Europe/London" <b:format.date format="M jS Y H:i" timezone="Europe/London"><b:page.metadata.created/></b:format.date>
HTML source output
Without custom timezone, defaulting to "Europe/Helsinki" February 23rd 2010 11:32 Set custom timezone to "Europe/London" February 23rd 2010 09:32

