Dashboard > blojsom > ... > Available Plugins > Date Format Plugin
  blojsom Log In   View a printable version of the current page.  
  Date Format Plugin
Added by David Czarnecki, last edited by David Czarnecki on Oct 21, 2004  (view change)
Labels: 
(None)

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 global /WEB-INF/plugin.properties file, add the following line:

date-format=org.blojsom.plugin.date.DateFormatPlugin

You may then add "date-format" to one of the flavor-based plugin chains. These plugin chains can be found in the individual user's plugin.properties file. For example:

html.blojsom-plugin-chain=...,date-format,...

The date format plugin has two properties that are added to the /WEB-INF/(blog-id)/blog.properties file:

blog-timezone-id=America/New_York

blog-dateformat-pattern=hh 'o''clock' a, zzzz

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

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators