Description
The date format plugin allows the blog owner to configure the running blog's time zone as well as to provide a custom format when outputting dates for blog entries.
Installation and Setup
In your /WEB-INF/classes/blojsom-plugins.xml file, add the following:
<bean id="date-format" class="org.blojsom.plugin.date.DateFormatPlugin" init-method="init" destroy-method="destroy"/>
You may then add "date-format" to one of the flavor-based plugin chains.
The date format plugin has two properties that are added to the blog's properties.
blog-timezone-id=America/New_York
blog-dateformat-pattern=hh 'o''clock' a, zzzz
The following properties can be set from Weblog Settings | Properties | Set Property
| Property |
Description |
| blog-timezone-id |
Sets the time zone identifier for the running blog |
| blog-dateformat-pattern |
Controls the pattern used to output blog entry dates displayed in one or more of the flavor-based templates |
You can find more information on valid date time patterns by looking at the javadocs for the SimpleDateFormat
class.
Usage and URL Parameters
You can use this in, for example, the Velocity templates by changing the following from:
<p class="weblogdateline">$entry.getDate()<br />
to
<p class="weblogdateline">$BLOJSOM_DATE_FORMAT.format( $entry.getDate() )<br />
Context Attributes and Types
The following table describes the context attributes that are available and their associated type.
| Context key |
Input or Output |
Type |
Description |
| BLOJSOM_DATE_FORMAT |
Output |
java.text.DateFormat |
Object appropriate for formatting java.util.Date objects using the format(Date date) method |