KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > presentation > weblog > tags > DateMacro


1 package org.roller.presentation.weblog.tags;
2
3 import java.text.SimpleDateFormat JavaDoc;
4 import java.util.Date JavaDoc;
5
6 /** For formatting a date using patterns from
7  * {@link java.text.SimpleDateFormat SimpleDateFormat}.
8  * @deprecated Use methods on
9  * {@link org.roller.presentation.weblog.WeblogEntryDataEx WeblogEntryDataEx}
10  * instead.
11  */

12 public class DateMacro
13 {
14     final Date JavaDoc mDate;
15     
16     /** Construct macro for specified date */
17     public DateMacro( Date JavaDoc d )
18     {
19         mDate = d;
20     }
21     
22     /** Format date using pattern */
23     public String JavaDoc view( String JavaDoc pattern )
24     {
25         SimpleDateFormat JavaDoc format = new SimpleDateFormat JavaDoc( pattern );
26         return format.format( mDate );
27     }
28     
29     /** Format date using standard format. */
30     public String JavaDoc toString()
31     {
32         return view("EEEE MMMM dd, yyyy");
33     }
34 }
35
36
37
Popular Tags