<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<!--NewPage--> | |
<HTML> | |
<HEAD> | |
<!-- Generated by javadoc (build 1.5.0_02) on Mon Nov 26 08:08:44 PST 2007 --> | |
<TITLE> | |
DateTool (VelocityTools 1.4 Documentation) | |
</TITLE> | |
<META NAME="keywords" CONTENT="org.apache.velocity.tools.generic.DateTool class"> | |
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> | |
<SCRIPT type="text/javascript"> | |
function windowTitle() | |
{ | |
parent.document.title="DateTool (VelocityTools 1.4 Documentation)"; | |
} | |
</SCRIPT> | |
<NOSCRIPT> | |
</NOSCRIPT> | |
</HEAD> | |
<BODY BGCOLOR="white" onload="windowTitle();"> | |
<!-- ========= START OF TOP NAVBAR ======= --> | |
<A NAME="navbar_top"><!-- --></A> | |
<A HREF="#skip-navbar_top" title="Skip navigation links"></A> | |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> | |
<TR> | |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> | |
<A NAME="navbar_top_firstrow"><!-- --></A> | |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> | |
<TR ALIGN="center" VALIGN="top"> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> | |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> | |
</TR> | |
</TABLE> | |
</TD> | |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> | |
</EM> | |
</TD> | |
</TR> | |
<TR> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../../org/apache/velocity/tools/generic/ComparisonDateTool.Comparison.html" title="class in org.apache.velocity.tools.generic"><B>PREV CLASS</B></A> | |
<A HREF="../../../../../org/apache/velocity/tools/generic/EscapeTool.html" title="class in org.apache.velocity.tools.generic"><B>NEXT CLASS</B></A></FONT></TD> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../../index.html?org/apache/velocity/tools/generic/DateTool.html" target="_top"><B>FRAMES</B></A> | |
<A HREF="DateTool.html" target="_top"><B>NO FRAMES</B></A> | |
<SCRIPT type="text/javascript"> | |
<!-- | |
if(window==top) { | |
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); | |
} | |
//--> | |
</SCRIPT> | |
<NOSCRIPT> | |
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> | |
</NOSCRIPT> | |
</FONT></TD> | |
</TR> | |
<TR> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> | |
</TR> | |
</TABLE> | |
<A NAME="skip-navbar_top"></A> | |
<!-- ========= END OF TOP NAVBAR ========= --> | |
<HR> | |
<!-- ======== START OF CLASS DATA ======== --> | |
<H2> | |
<FONT SIZE="-1"> | |
org.apache.velocity.tools.generic</FONT> | |
<BR> | |
Class DateTool</H2> | |
<PRE> | |
java.lang.Object | |
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.velocity.tools.generic.DateTool</B> | |
</PRE> | |
<DL> | |
<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../../org/apache/velocity/tools/generic/ComparisonDateTool.html" title="class in org.apache.velocity.tools.generic">ComparisonDateTool</A></DD> | |
</DL> | |
<HR> | |
<DL> | |
<DT><PRE>public class <B>DateTool</B><DT>extends java.lang.Object</DL> | |
</PRE> | |
<P> | |
Tool for working with <CODE>Date</CODE> and <CODE>Calendar</CODE> | |
in Velocity templates. It is useful for accessing and | |
formatting the "current" date as well as for formatting | |
arbitrary <CODE>Date</CODE> and <CODE>Calendar</CODE> objects. Also | |
the tool can be used to retrieve <CODE>DateFormat</CODE> instances | |
or make conversions to and from various date types. | |
<p><pre> | |
Example of formatting the "current" date: | |
$date -> Oct 19, 2003 9:54:50 PM | |
$date.long -> October 19, 2003 9:54:50 PM PDT | |
$date.medium_time -> 9:54:50 PM | |
$date.full_date -> Sunday, October 19, 2003 | |
$date.get('default','short') -> Oct 19, 2003 9:54 PM | |
$date.get('yyyy-M-d H:m:s') -> 2003-10-19 21:54:50 | |
Example of formatting an arbitrary date: | |
$myDate -> Tue Oct 07 03:14:50 PDT 2003 | |
$date.format('medium',$myDate) -> Oct 7, 2003 3:14:50 AM | |
Example toolbox.xml config (if you want to use this with VelocityView): | |
<tool> | |
<key>date</key> | |
<scope>application</scope> | |
<class>org.apache.velocity.tools.generic.DateTool</class> | |
<parameter name="format" value="yyyy-M-d"/> | |
</tool> | |
</pre></p> | |
<p>The methods of this tool are highly interconnected, and overriding | |
key methods provides an easy way to create subclasses that use | |
a non-default format, calendar, locale, or timezone.</p> | |
<P> | |
<P> | |
<DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.0</DD> | |
<DT><B>Version:</B></DT> | |
<DD>$Revision: 509840 $ $Date: 2007-02-20 16:59:26 -0800 (Tue, 20 Feb 2007) $</DD> | |
<DT><B>Author:</B></DT> | |
<DD>Nathan Bubna</DD> | |
</DL> | |
<HR> | |
<P> | |
<!-- =========== FIELD SUMMARY =========== --> | |
<A NAME="field_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Field Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>private boolean</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#configLocked">configLocked</A></B></CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#DEFAULT_FORMAT">DEFAULT_FORMAT</A></B></CODE> | |
<BR> | |
The default format to be used when none is specified.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#DEFAULT_FORMAT_KEY">DEFAULT_FORMAT_KEY</A></B></CODE> | |
<BR> | |
The key used for specifying a default format via toolbox params.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#DEFAULT_LOCALE_KEY">DEFAULT_LOCALE_KEY</A></B></CODE> | |
<BR> | |
The key used for specifying a default locale via toolbox params.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>private java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format">format</A></B></CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>private java.util.Locale</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#locale">locale</A></B></CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#LOCK_CONFIG_KEY">LOCK_CONFIG_KEY</A></B></CODE> | |
<BR> | |
The key used for specifying whether or not to prevent templates | |
from reconfiguring this tool.</TD> | |
</TR> | |
</TABLE> | |
| |
<!-- ======== CONSTRUCTOR SUMMARY ======== --> | |
<A NAME="constructor_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Constructor Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#DateTool()">DateTool</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
</TABLE> | |
| |
<!-- ========== METHOD SUMMARY =========== --> | |
<A NAME="method_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Method Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#configure(java.util.Map)">configure</A></B>(java.util.Map params)</CODE> | |
<BR> | |
Looks for configuration values in the given params.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>protected void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#configure(org.apache.velocity.tools.generic.ValueParser)">configure</A></B>(<A HREF="../../../../../org/apache/velocity/tools/generic/ValueParser.html" title="class in org.apache.velocity.tools.generic">ValueParser</A> values)</CODE> | |
<BR> | |
Does the actual configuration.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.Object)">format</A></B>(java.lang.Object obj)</CODE> | |
<BR> | |
Converts the specified object to a date and formats it according to | |
the pattern or style returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getFormat()"><CODE>getFormat()</CODE></A>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.Object)">format</A></B>(java.lang.String format, | |
java.lang.Object obj)</CODE> | |
<BR> | |
Converts the specified object to a date and returns | |
a formatted string representing that date in the locale | |
returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.Object, java.util.Locale)">format</A></B>(java.lang.String format, | |
java.lang.Object obj, | |
java.util.Locale locale)</CODE> | |
<BR> | |
Converts the specified object to a date and returns | |
a formatted string representing that date in the specified | |
<CODE>Locale</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)">format</A></B>(java.lang.String format, | |
java.lang.Object obj, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Returns a formatted string representing the specified date, | |
<CODE>Locale</CODE>, and <CODE>TimeZone</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.String, java.lang.Object)">format</A></B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.lang.Object obj)</CODE> | |
<BR> | |
Returns the specified date as a string formatted according to the | |
specified date and/or time styles.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale)">format</A></B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.lang.Object obj, | |
java.util.Locale locale)</CODE> | |
<BR> | |
Returns the specified date as a string formatted according to the | |
specified <CODE>Locale</CODE> and date and/or time styles.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)">format</A></B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.lang.Object obj, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Returns the specified date as a string formatted according to the | |
specified <CODE>Locale</CODE> and date and/or time styles.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#get(java.lang.String)">get</A></B>(java.lang.String format)</CODE> | |
<BR> | |
Returns a formatted string representing the date returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDate()"><CODE>getDate()</CODE></A>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#get(java.lang.String, java.lang.String)">get</A></B>(java.lang.String dateStyle, | |
java.lang.String timeStyle)</CODE> | |
<BR> | |
Returns a formatted string representing the date and/or time given by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDate()"><CODE>getDate()</CODE></A> in standard, localized patterns.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Calendar</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()">getCalendar</A></B>()</CODE> | |
<BR> | |
Returns a <CODE>Calendar</CODE> instance created using the timezone and | |
locale returned by getTimeZone() and getLocale().</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDate()">getDate</A></B>()</CODE> | |
<BR> | |
Returns a <CODE>Date</CODE> derived from the result of <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A></TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>protected java.text.DateFormat</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDateFormat(int, int, java.util.Locale, java.util.TimeZone)">getDateFormat</A></B>(int dateStyle, | |
int timeStyle, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Returns a <CODE>DateFormat</CODE> instance for the specified | |
time style, date style, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.text.DateFormat</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)">getDateFormat</A></B>(java.lang.String format, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Returns a <CODE>DateFormat</CODE> instance for the specified | |
format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.text.DateFormat</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDateFormat(java.lang.String, java.lang.String, java.util.Locale, java.util.TimeZone)">getDateFormat</A></B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Returns a <CODE>DateFormat</CODE> instance for the specified | |
date style, time style, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDay()">getDay</A></B>()</CODE> | |
<BR> | |
Returns the day (of the month) value of the date | |
returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDay(java.lang.Object)">getDay</A></B>(java.lang.Object date)</CODE> | |
<BR> | |
Returns the day (of the month) value for the specified date.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getFormat()">getFormat</A></B>()</CODE> | |
<BR> | |
Return the pattern or style to be used for formatting dates when none | |
is specified.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Locale</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()">getLocale</A></B>()</CODE> | |
<BR> | |
This implementation returns the configured default locale.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getMonth()">getMonth</A></B>()</CODE> | |
<BR> | |
Returns the month value of the date returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getMonth(java.lang.Object)">getMonth</A></B>(java.lang.Object date)</CODE> | |
<BR> | |
Returns the month value of the specified date.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>protected int</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getStyleAsInt(java.lang.String)">getStyleAsInt</A></B>(java.lang.String style)</CODE> | |
<BR> | |
Checks a string to see if it matches one of the standard DateFormat | |
style patterns: FULL, LONG, MEDIUM, SHORT, or DEFAULT.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.util.Calendar</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getSystemCalendar()">getSystemCalendar</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getSystemDate()">getSystemDate</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static long</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getSystemTime()">getSystemTime</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.TimeZone</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getTimeZone()">getTimeZone</A></B>()</CODE> | |
<BR> | |
This implementation returns the default TimeZone.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getValue(int, java.lang.Object)">getValue</A></B>(int field, | |
java.lang.Object date)</CODE> | |
<BR> | |
Returns the specified value of the specified date, | |
or null if the field or date is invalid.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getValue(java.lang.Object)">getValue</A></B>(java.lang.Object field)</CODE> | |
<BR> | |
Return the specified value of the date returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A> or null if the field is invalid.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getValue(java.lang.Object, java.lang.Object)">getValue</A></B>(java.lang.Object field, | |
java.lang.Object date)</CODE> | |
<BR> | |
Returns the specified value of the specified date, | |
or null if the field or date is invalid.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getYear()">getYear</A></B>()</CODE> | |
<BR> | |
Returns the year value of the date returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.Integer</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getYear(java.lang.Object)">getYear</A></B>(java.lang.Object date)</CODE> | |
<BR> | |
Returns the year value of the specified date.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>protected void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#setFormat(java.lang.String)">setFormat</A></B>(java.lang.String format)</CODE> | |
<BR> | |
Sets the default format for this instance.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>protected void</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#setLocale(java.util.Locale)">setLocale</A></B>(java.util.Locale locale)</CODE> | |
<BR> | |
Sets the default locale for this instance.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Calendar</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toCalendar(java.lang.Object)">toCalendar</A></B>(java.lang.Object obj)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Calendar</CODE> using the | |
locale returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A> if necessary.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Calendar</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toCalendar(java.lang.Object, java.util.Locale)">toCalendar</A></B>(java.lang.Object obj, | |
java.util.Locale locale)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Calendar</CODE> using the | |
locale returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A> if necessary.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toDate(java.lang.Object)">toDate</A></B>(java.lang.Object obj)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Date</CODE> using the | |
format returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getFormat()"><CODE>getFormat()</CODE></A>,the <CODE>Locale</CODE> returned | |
by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A>, and the <CODE>TimeZone</CODE> returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getTimeZone()"><CODE>getTimeZone()</CODE></A> if the object is not already an instance | |
of Date, Calendar, or Long.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toDate(java.lang.String, java.lang.Object)">toDate</A></B>(java.lang.String format, | |
java.lang.Object obj)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format,the <CODE>Locale</CODE> returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A>, and the <CODE>TimeZone</CODE> returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getTimeZone()"><CODE>getTimeZone()</CODE></A> if the object is not already an instance | |
of Date, Calendar, or Long.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toDate(java.lang.String, java.lang.Object, java.util.Locale)">toDate</A></B>(java.lang.String format, | |
java.lang.Object obj, | |
java.util.Locale locale)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format and <CODE>Locale</CODE> if the object is not already | |
an instance of Date, Calendar, or Long.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toDate(java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)">toDate</A></B>(java.lang.String format, | |
java.lang.Object obj, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE> if the | |
object is not already an instance of Date, Calendar, or Long.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toString()">toString</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
</TABLE> | |
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> | |
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD> | |
</TR> | |
</TABLE> | |
| |
<P> | |
<!-- ============ FIELD DETAIL =========== --> | |
<A NAME="field_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Field Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="DEFAULT_FORMAT"><!-- --></A><H3> | |
DEFAULT_FORMAT</H3> | |
<PRE> | |
public static final java.lang.String <B>DEFAULT_FORMAT</B></PRE> | |
<DL> | |
<DD>The default format to be used when none is specified. | |
<P> | |
<DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.velocity.tools.generic.DateTool.DEFAULT_FORMAT">Constant Field Values</A></DL> | |
</DL> | |
<HR> | |
<A NAME="DEFAULT_FORMAT_KEY"><!-- --></A><H3> | |
DEFAULT_FORMAT_KEY</H3> | |
<PRE> | |
public static final java.lang.String <B>DEFAULT_FORMAT_KEY</B></PRE> | |
<DL> | |
<DD>The key used for specifying a default format via toolbox params. | |
<P> | |
<DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.3</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.velocity.tools.generic.DateTool.DEFAULT_FORMAT_KEY">Constant Field Values</A></DL> | |
</DL> | |
<HR> | |
<A NAME="DEFAULT_LOCALE_KEY"><!-- --></A><H3> | |
DEFAULT_LOCALE_KEY</H3> | |
<PRE> | |
public static final java.lang.String <B>DEFAULT_LOCALE_KEY</B></PRE> | |
<DL> | |
<DD>The key used for specifying a default locale via toolbox params. | |
<P> | |
<DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.4</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.velocity.tools.generic.DateTool.DEFAULT_LOCALE_KEY">Constant Field Values</A></DL> | |
</DL> | |
<HR> | |
<A NAME="LOCK_CONFIG_KEY"><!-- --></A><H3> | |
LOCK_CONFIG_KEY</H3> | |
<PRE> | |
public static final java.lang.String <B>LOCK_CONFIG_KEY</B></PRE> | |
<DL> | |
<DD>The key used for specifying whether or not to prevent templates | |
from reconfiguring this tool. The default is true. | |
<P> | |
<DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.4</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.apache.velocity.tools.generic.DateTool.LOCK_CONFIG_KEY">Constant Field Values</A></DL> | |
</DL> | |
<HR> | |
<A NAME="format"><!-- --></A><H3> | |
format</H3> | |
<PRE> | |
private java.lang.String <B>format</B></PRE> | |
<DL> | |
<DL> | |
</DL> | |
</DL> | |
<HR> | |
<A NAME="locale"><!-- --></A><H3> | |
locale</H3> | |
<PRE> | |
private java.util.Locale <B>locale</B></PRE> | |
<DL> | |
<DL> | |
</DL> | |
</DL> | |
<HR> | |
<A NAME="configLocked"><!-- --></A><H3> | |
configLocked</H3> | |
<PRE> | |
private boolean <B>configLocked</B></PRE> | |
<DL> | |
<DL> | |
</DL> | |
</DL> | |
<!-- ========= CONSTRUCTOR DETAIL ======== --> | |
<A NAME="constructor_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Constructor Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="DateTool()"><!-- --></A><H3> | |
DateTool</H3> | |
<PRE> | |
public <B>DateTool</B>()</PRE> | |
<DL> | |
</DL> | |
<!-- ============ METHOD DETAIL ========== --> | |
<A NAME="method_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Method Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="configure(java.util.Map)"><!-- --></A><H3> | |
configure</H3> | |
<PRE> | |
public void <B>configure</B>(java.util.Map params)</PRE> | |
<DL> | |
<DD>Looks for configuration values in the given params. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.3</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="configure(org.apache.velocity.tools.generic.ValueParser)"><!-- --></A><H3> | |
configure</H3> | |
<PRE> | |
protected void <B>configure</B>(<A HREF="../../../../../org/apache/velocity/tools/generic/ValueParser.html" title="class in org.apache.velocity.tools.generic">ValueParser</A> values)</PRE> | |
<DL> | |
<DD>Does the actual configuration. This is protected, so | |
subclasses may share the same ValueParser and call configure | |
at any time, while preventing templates from doing so when | |
configure(Map) is locked. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.4</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getSystemTime()"><!-- --></A><H3> | |
getSystemTime</H3> | |
<PRE> | |
public static final long <B>getSystemTime</B>()</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the system's current time as the number of milliseconds | |
elapsed since January 1, 1970, 00:00:00 GMT.</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getSystemDate()"><!-- --></A><H3> | |
getSystemDate</H3> | |
<PRE> | |
public static final java.util.Date <B>getSystemDate</B>()</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the system's current time as a <CODE>Date</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getSystemCalendar()"><!-- --></A><H3> | |
getSystemCalendar</H3> | |
<PRE> | |
public static final java.util.Calendar <B>getSystemCalendar</B>()</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the system's current time as a <CODE>Calendar</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getLocale()"><!-- --></A><H3> | |
getLocale</H3> | |
<PRE> | |
public java.util.Locale <B>getLocale</B>()</PRE> | |
<DL> | |
<DD>This implementation returns the configured default locale. Subclasses | |
may override this to return alternate locales. Please note that | |
doing so will affect all formatting methods where no locale is | |
specified in the parameters. | |
<P> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the default <CODE>Locale</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="setLocale(java.util.Locale)"><!-- --></A><H3> | |
setLocale</H3> | |
<PRE> | |
protected void <B>setLocale</B>(java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Sets the default locale for this instance. This is protected, | |
because templates ought not to be using it; that would not | |
be threadsafe so far as templates are concerned. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.4</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getTimeZone()"><!-- --></A><H3> | |
getTimeZone</H3> | |
<PRE> | |
public java.util.TimeZone <B>getTimeZone</B>()</PRE> | |
<DL> | |
<DD>This implementation returns the default TimeZone. Subclasses | |
may override this to return alternate timezones. Please note that | |
doing so will affect all formatting methods where no timezone is | |
specified in the parameters. | |
<P> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the default <CODE>TimeZone</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDate()"><!-- --></A><H3> | |
getDate</H3> | |
<PRE> | |
public java.util.Date <B>getDate</B>()</PRE> | |
<DL> | |
<DD>Returns a <CODE>Date</CODE> derived from the result of <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A> | |
<P> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>a <CODE>Date</CODE> derived from the result of <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getCalendar()"><!-- --></A><H3> | |
getCalendar</H3> | |
<PRE> | |
public java.util.Calendar <B>getCalendar</B>()</PRE> | |
<DL> | |
<DD>Returns a <CODE>Calendar</CODE> instance created using the timezone and | |
locale returned by getTimeZone() and getLocale(). This allows subclasses | |
to easily override the default locale and timezone used by this tool. | |
<p>Sub-classes may override this method to return a Calendar instance | |
not based on the system date. | |
Doing so will also cause the getDate(), get(String), get(String,String), | |
and toString() methods to return dates equivalent to the Calendar | |
returned by this method, because those methods return values derived | |
from the result of this method.</p> | |
<P> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>a <CODE>Calendar</CODE> instance created using the results of | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getTimeZone()"><CODE>getTimeZone()</CODE></A> and <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A>.<DT><B>See Also:</B><DD><CODE>Calendar.getInstance(TimeZone zone, Locale aLocale)</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getFormat()"><!-- --></A><H3> | |
getFormat</H3> | |
<PRE> | |
public java.lang.String <B>getFormat</B>()</PRE> | |
<DL> | |
<DD>Return the pattern or style to be used for formatting dates when none | |
is specified. This implementation gives a 'default' date-time format. | |
Subclasses may override this to provide a different default format. | |
<p>This can now be configured via the toolbox definition. | |
Add a <code><parameter name="format" value="short"/><code> | |
to your date tool configuration.</p> | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="setFormat(java.lang.String)"><!-- --></A><H3> | |
setFormat</H3> | |
<PRE> | |
protected void <B>setFormat</B>(java.lang.String format)</PRE> | |
<DL> | |
<DD>Sets the default format for this instance. This is protected, | |
because templates ought not to be using it; that would not | |
be threadsafe so far as templates are concerned. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.3</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getYear()"><!-- --></A><H3> | |
getYear</H3> | |
<PRE> | |
public java.lang.Integer <B>getYear</B>()</PRE> | |
<DL> | |
<DD>Returns the year value of the date returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A>. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getYear(java.lang.Object)"><!-- --></A><H3> | |
getYear</H3> | |
<PRE> | |
public java.lang.Integer <B>getYear</B>(java.lang.Object date)</PRE> | |
<DL> | |
<DD>Returns the year value of the specified date. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getMonth()"><!-- --></A><H3> | |
getMonth</H3> | |
<PRE> | |
public java.lang.Integer <B>getMonth</B>()</PRE> | |
<DL> | |
<DD>Returns the month value of the date returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A>. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getMonth(java.lang.Object)"><!-- --></A><H3> | |
getMonth</H3> | |
<PRE> | |
public java.lang.Integer <B>getMonth</B>(java.lang.Object date)</PRE> | |
<DL> | |
<DD>Returns the month value of the specified date. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDay()"><!-- --></A><H3> | |
getDay</H3> | |
<PRE> | |
public java.lang.Integer <B>getDay</B>()</PRE> | |
<DL> | |
<DD>Returns the day (of the month) value of the date | |
returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A>. | |
<br><br> | |
NOTE: Unlike java.util.Date, this returns the day of the month. | |
It is equivalent to Date.getDate() and | |
Calendar.get(Calendar.DAY_OF_MONTH). We could not call this method | |
getDate() because that already exists in this class with a different | |
function. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDay(java.lang.Object)"><!-- --></A><H3> | |
getDay</H3> | |
<PRE> | |
public java.lang.Integer <B>getDay</B>(java.lang.Object date)</PRE> | |
<DL> | |
<DD>Returns the day (of the month) value for the specified date. | |
<br><br> | |
NOTE: Unlike java.util.Date, this returns the day of the month. | |
It is equivalent to Date.getDate() and | |
Calendar.get(Calendar.DAY_OF_MONTH). We could not call this method | |
getDate() because that already exists in this class with a different | |
function. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getValue(java.lang.Object)"><!-- --></A><H3> | |
getValue</H3> | |
<PRE> | |
public java.lang.Integer <B>getValue</B>(java.lang.Object field)</PRE> | |
<DL> | |
<DD>Return the specified value of the date returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getCalendar()"><CODE>getCalendar()</CODE></A> or null if the field is invalid. | |
<P> | |
<DD><DL> | |
<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getValue(java.lang.Object, java.lang.Object)"><!-- --></A><H3> | |
getValue</H3> | |
<PRE> | |
public java.lang.Integer <B>getValue</B>(java.lang.Object field, | |
java.lang.Object date)</PRE> | |
<DL> | |
<DD>Returns the specified value of the specified date, | |
or null if the field or date is invalid. The field may be | |
an Integer or it may be the name of the field as a String. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>field</CODE> - the corresponding Integer value or String name of the desired value<DD><CODE>date</CODE> - the date/calendar from which the field value will be taken<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getValue(int, java.lang.Object)"><!-- --></A><H3> | |
getValue</H3> | |
<PRE> | |
public java.lang.Integer <B>getValue</B>(int field, | |
java.lang.Object date)</PRE> | |
<DL> | |
<DD>Returns the specified value of the specified date, | |
or null if the field or date is invalid. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>field</CODE> - the int for the desired field (e.g. Calendar.MONTH)<DD><CODE>date</CODE> - the date/calendar from which the field value will be taken<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.2</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="get(java.lang.String)"><!-- --></A><H3> | |
get</H3> | |
<PRE> | |
public java.lang.String <B>get</B>(java.lang.String format)</PRE> | |
<DL> | |
<DD>Returns a formatted string representing the date returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDate()"><CODE>getDate()</CODE></A>. In its default implementation, this method | |
allows you to retrieve the current date in standard formats by | |
simply doing things like <code>$date.medium</code> or | |
<code>$date.full</code>. If you want only the date or time portion | |
you can specify that along with the standard formats. (e.g. | |
<code>$date.medium_date</code> or <code>$date.short_time</code>) | |
More complex or custom formats can be retrieved | |
by using the full method syntax. (e.g. $date.get('E, MMMM d')) | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the formatting instructions | |
<DT><B>Returns:</B><DD>a formatted representation of the date returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDate()"><CODE>getDate()</CODE></A><DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><CODE>format(String format, Object obj, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="get(java.lang.String, java.lang.String)"><!-- --></A><H3> | |
get</H3> | |
<PRE> | |
public java.lang.String <B>get</B>(java.lang.String dateStyle, | |
java.lang.String timeStyle)</PRE> | |
<DL> | |
<DD>Returns a formatted string representing the date and/or time given by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDate()"><CODE>getDate()</CODE></A> in standard, localized patterns. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the style pattern for the date<DD><CODE>timeStyle</CODE> - the style pattern for the time | |
<DT><B>Returns:</B><DD>a formatted representation of the date returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDate()"><CODE>getDate()</CODE></A><DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><CODE>DateFormat</CODE>, | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><CODE>format(String dateStyle, String timeStyle, Object obj, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="format(java.lang.Object)"><!-- --></A><H3> | |
format</H3> | |
<PRE> | |
public java.lang.String <B>format</B>(java.lang.Object obj)</PRE> | |
<DL> | |
<DD>Converts the specified object to a date and formats it according to | |
the pattern or style returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getFormat()"><CODE>getFormat()</CODE></A>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the date object to be formatted | |
<DT><B>Returns:</B><DD>the specified date formatted as a string<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><CODE>format(String format, Object obj, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="format(java.lang.String, java.lang.Object)"><!-- --></A><H3> | |
format</H3> | |
<PRE> | |
public java.lang.String <B>format</B>(java.lang.String format, | |
java.lang.Object obj)</PRE> | |
<DL> | |
<DD>Converts the specified object to a date and returns | |
a formatted string representing that date in the locale | |
returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the formatting instructions<DD><CODE>obj</CODE> - the date object to be formatted | |
<DT><B>Returns:</B><DD>a formatted string for this locale representing the specified | |
date or <code>null</code> if the parameters are invalid<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><CODE>format(String format, Object obj, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="format(java.lang.String, java.lang.Object, java.util.Locale)"><!-- --></A><H3> | |
format</H3> | |
<PRE> | |
public java.lang.String <B>format</B>(java.lang.String format, | |
java.lang.Object obj, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Converts the specified object to a date and returns | |
a formatted string representing that date in the specified | |
<CODE>Locale</CODE>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the formatting instructions<DD><CODE>obj</CODE> - the date object to be formatted<DD><CODE>locale</CODE> - the locale to be used when formatting | |
<DT><B>Returns:</B><DD>the given date as a formatted string<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><CODE>format(String format, Object obj, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="format(java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
format</H3> | |
<PRE> | |
public java.lang.String <B>format</B>(java.lang.String format, | |
java.lang.Object obj, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Returns a formatted string representing the specified date, | |
<CODE>Locale</CODE>, and <CODE>TimeZone</CODE>. | |
<p> | |
The specified format may be a standard style pattern ('full', 'long', | |
'medium', 'short', or 'default'). | |
</p> | |
<p> | |
You may also specify that you want only the date or time portion be | |
appending '_date' or '_time' respectively to the standard style pattern. | |
(e.g. 'full_date' or 'long_time') | |
</p> | |
<p> | |
If the format fits neither of these patterns, then the output | |
will be formatted according to the symbols defined by | |
<CODE>SimpleDateFormat</CODE>: | |
<pre> | |
Symbol Meaning Presentation Example | |
------ ------- ------------ ------- | |
G era designator (Text) AD | |
y year (Number) 1996 | |
M month in year (Text & Number) July & 07 | |
d day in month (Number) 10 | |
h hour in am/pm (1~12) (Number) 12 | |
H hour in day (0~23) (Number) 0 | |
m minute in hour (Number) 30 | |
s second in minute (Number) 55 | |
S millisecond (Number) 978 | |
E day in week (Text) Tuesday | |
D day in year (Number) 189 | |
F day of week in month (Number) 2 (2nd Wed in July) | |
w week in year (Number) 27 | |
W week in month (Number) 2 | |
a am/pm marker (Text) PM | |
k hour in day (1~24) (Number) 24 | |
K hour in am/pm (0~11) (Number) 0 | |
z time zone (Text) Pacific Standard Time | |
' escape for text (Delimiter) | |
'' single quote (Literal) ' | |
Examples: "E, MMMM d" will result in "Tue, July 24" | |
"EEE, M-d (H:m)" will result in "Tuesday, 7-24 (14:12)" | |
</pre> | |
</p> | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the custom or standard pattern to be used<DD><CODE>obj</CODE> - the date to format<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to format the date for<DD><CODE>timezone</CODE> - the <CODE>TimeZone</CODE> to be used when formatting | |
<DT><B>Returns:</B><DD>a formatted string representing the specified date or | |
<code>null</code> if the parameters are invalid<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="format(java.lang.String, java.lang.String, java.lang.Object)"><!-- --></A><H3> | |
format</H3> | |
<PRE> | |
public java.lang.String <B>format</B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.lang.Object obj)</PRE> | |
<DL> | |
<DD>Returns the specified date as a string formatted according to the | |
specified date and/or time styles. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the style pattern for the date<DD><CODE>timeStyle</CODE> - the style pattern for the time<DD><CODE>obj</CODE> - the date to be formatted | |
<DT><B>Returns:</B><DD>a formatted representation of the given date<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><CODE>format(String dateStyle, String timeStyle, Object obj, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="format(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale)"><!-- --></A><H3> | |
format</H3> | |
<PRE> | |
public java.lang.String <B>format</B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.lang.Object obj, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Returns the specified date as a string formatted according to the | |
specified <CODE>Locale</CODE> and date and/or time styles. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the style pattern for the date<DD><CODE>timeStyle</CODE> - the style pattern for the time<DD><CODE>obj</CODE> - the date to be formatted<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used for formatting the date | |
<DT><B>Returns:</B><DD>a formatted representation of the given date<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><CODE>format(String dateStyle, String timeStyle, Object obj, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="format(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
format</H3> | |
<PRE> | |
public java.lang.String <B>format</B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.lang.Object obj, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Returns the specified date as a string formatted according to the | |
specified <CODE>Locale</CODE> and date and/or time styles. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the style pattern for the date<DD><CODE>timeStyle</CODE> - the style pattern for the time<DD><CODE>obj</CODE> - the date to be formatted<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used for formatting the date<DD><CODE>timezone</CODE> - the <CODE>TimeZone</CODE> the date should be formatted for | |
<DT><B>Returns:</B><DD>a formatted representation of the given date<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><CODE>DateFormat</CODE>, | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><CODE>format(String dateStyle, String timeStyle, Object obj, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
getDateFormat</H3> | |
<PRE> | |
public java.text.DateFormat <B>getDateFormat</B>(java.lang.String format, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Returns a <CODE>DateFormat</CODE> instance for the specified | |
format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>. If the format | |
specified is a standard style pattern, then a date-time instance | |
will be returned with both the date and time styles set to the | |
specified style. If it is a custom format, then a customized | |
<CODE>SimpleDateFormat</CODE> will be returned. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the custom or standard formatting pattern to be used<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used<DD><CODE>timezone</CODE> - the <CODE>TimeZone</CODE> to be used | |
<DT><B>Returns:</B><DD>an instance of <CODE>DateFormat</CODE><DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><CODE>SimpleDateFormat</CODE>, | |
<CODE>DateFormat</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDateFormat(java.lang.String, java.lang.String, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
getDateFormat</H3> | |
<PRE> | |
public java.text.DateFormat <B>getDateFormat</B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Returns a <CODE>DateFormat</CODE> instance for the specified | |
date style, time style, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the date style<DD><CODE>timeStyle</CODE> - the time style<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used<DD><CODE>timezone</CODE> - the <CODE>TimeZone</CODE> to be used | |
<DT><B>Returns:</B><DD>an instance of <CODE>DateFormat</CODE><DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDateFormat(int, int, java.util.Locale, java.util.TimeZone)"><CODE>getDateFormat(int timeStyle, int dateStyle, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDateFormat(int, int, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
getDateFormat</H3> | |
<PRE> | |
protected java.text.DateFormat <B>getDateFormat</B>(int dateStyle, | |
int timeStyle, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Returns a <CODE>DateFormat</CODE> instance for the specified | |
time style, date style, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the date style (date will be ignored if this is | |
less than zero and the date style is not)<DD><CODE>timeStyle</CODE> - the time style (time will be ignored if this is | |
less than zero and the date style is not)<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used<DD><CODE>timezone</CODE> - the <CODE>TimeZone</CODE> to be used | |
<DT><B>Returns:</B><DD>an instance of <CODE>DateFormat</CODE> or <code>null</code> | |
if an instance cannot be constructed with the given | |
parameters<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getStyleAsInt(java.lang.String)"><!-- --></A><H3> | |
getStyleAsInt</H3> | |
<PRE> | |
protected int <B>getStyleAsInt</B>(java.lang.String style)</PRE> | |
<DL> | |
<DD>Checks a string to see if it matches one of the standard DateFormat | |
style patterns: FULL, LONG, MEDIUM, SHORT, or DEFAULT. If it does, | |
it will return the integer constant for that pattern. If not, it | |
will return -1. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>style</CODE> - the string to be checked | |
<DT><B>Returns:</B><DD>the int identifying the style pattern<DT><B>Since:</B></DT> | |
<DD>VelocityTools 1.1</DD> | |
<DT><B>See Also:</B><DD><CODE>DateFormat</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toDate(java.lang.Object)"><!-- --></A><H3> | |
toDate</H3> | |
<PRE> | |
public java.util.Date <B>toDate</B>(java.lang.Object obj)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Date</CODE> using the | |
format returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getFormat()"><CODE>getFormat()</CODE></A>,the <CODE>Locale</CODE> returned | |
by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A>, and the <CODE>TimeZone</CODE> returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getTimeZone()"><CODE>getTimeZone()</CODE></A> if the object is not already an instance | |
of Date, Calendar, or Long. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the date to convert | |
<DT><B>Returns:</B><DD>the object as a <CODE>Date</CODE> or <code>null</code> if no | |
conversion is possible</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toDate(java.lang.String, java.lang.Object)"><!-- --></A><H3> | |
toDate</H3> | |
<PRE> | |
public java.util.Date <B>toDate</B>(java.lang.String format, | |
java.lang.Object obj)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format,the <CODE>Locale</CODE> returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A>, and the <CODE>TimeZone</CODE> returned by | |
<A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getTimeZone()"><CODE>getTimeZone()</CODE></A> if the object is not already an instance | |
of Date, Calendar, or Long. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - - the format the date is in<DD><CODE>obj</CODE> - - the date to convert | |
<DT><B>Returns:</B><DD>the object as a <CODE>Date</CODE> or <code>null</code> if no | |
conversion is possible<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toDate(java.lang.String, java.lang.Object, java.util.Locale)"><CODE>toDate(String format, Object obj, Locale locale)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toDate(java.lang.String, java.lang.Object, java.util.Locale)"><!-- --></A><H3> | |
toDate</H3> | |
<PRE> | |
public java.util.Date <B>toDate</B>(java.lang.String format, | |
java.lang.Object obj, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format and <CODE>Locale</CODE> if the object is not already | |
an instance of Date, Calendar, or Long. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - - the format the date is in<DD><CODE>obj</CODE> - - the date to convert<DD><CODE>locale</CODE> - - the <CODE>Locale</CODE> | |
<DT><B>Returns:</B><DD>the object as a <CODE>Date</CODE> or <code>null</code> if no | |
conversion is possible<DT><B>See Also:</B><DD><CODE>SimpleDateFormat.parse(java.lang.String, java.text.ParsePosition)</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toDate(java.lang.String, java.lang.Object, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
toDate</H3> | |
<PRE> | |
public java.util.Date <B>toDate</B>(java.lang.String format, | |
java.lang.Object obj, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE> if the | |
object is not already an instance of Date, Calendar, or Long. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - - the format the date is in<DD><CODE>obj</CODE> - - the date to convert<DD><CODE>locale</CODE> - - the <CODE>Locale</CODE><DD><CODE>timezone</CODE> - - the <CODE>TimeZone</CODE> | |
<DT><B>Returns:</B><DD>the object as a <CODE>Date</CODE> or <code>null</code> if no | |
conversion is possible<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)"><CODE>getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)</CODE></A>, | |
<CODE>SimpleDateFormat.parse(java.lang.String, java.text.ParsePosition)</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toCalendar(java.lang.Object)"><!-- --></A><H3> | |
toCalendar</H3> | |
<PRE> | |
public java.util.Calendar <B>toCalendar</B>(java.lang.Object obj)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Calendar</CODE> using the | |
locale returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A> if necessary. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the date to convert | |
<DT><B>Returns:</B><DD>the converted date<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toCalendar(java.lang.Object, java.util.Locale)"><CODE>toCalendar(Object obj, Locale locale)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toCalendar(java.lang.Object, java.util.Locale)"><!-- --></A><H3> | |
toCalendar</H3> | |
<PRE> | |
public java.util.Calendar <B>toCalendar</B>(java.lang.Object obj, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Calendar</CODE> using the | |
locale returned by <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getLocale()"><CODE>getLocale()</CODE></A> if necessary. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the date to convert<DD><CODE>locale</CODE> - the locale used | |
<DT><B>Returns:</B><DD>the converted date<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#toDate(java.lang.String, java.lang.Object, java.util.Locale)"><CODE>toDate(String format, Object obj, Locale locale)</CODE></A>, | |
<CODE>Calendar</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toString()"><!-- --></A><H3> | |
toString</H3> | |
<PRE> | |
public java.lang.String <B>toString</B>()</PRE> | |
<DL> | |
<DD><DL> | |
<DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL> | |
</DD> | |
<DD><DL> | |
<DT><B>Returns:</B><DD>the result of <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getDate()"><CODE>getDate()</CODE></A> formatted according to the result | |
of <A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#getFormat()"><CODE>getFormat()</CODE></A>.<DT><B>See Also:</B><DD><A HREF="../../../../../org/apache/velocity/tools/generic/DateTool.html#format(java.lang.String, java.lang.Object)"><CODE>format(String format, Object obj)</CODE></A></DL> | |
</DD> | |
</DL> | |
<!-- ========= END OF CLASS DATA ========= --> | |
<HR> | |
<!-- ======= START OF BOTTOM NAVBAR ====== --> | |
<A NAME="navbar_bottom"><!-- --></A> | |
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> | |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> | |
<TR> | |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> | |
<A NAME="navbar_bottom_firstrow"><!-- --></A> | |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> | |
<TR ALIGN="center" VALIGN="top"> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> | |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> | |
</TR> | |
</TABLE> | |
</TD> | |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> | |
</EM> | |
</TD> | |
</TR> | |
<TR> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../../org/apache/velocity/tools/generic/ComparisonDateTool.Comparison.html" title="class in org.apache.velocity.tools.generic"><B>PREV CLASS</B></A> | |
<A HREF="../../../../../org/apache/velocity/tools/generic/EscapeTool.html" title="class in org.apache.velocity.tools.generic"><B>NEXT CLASS</B></A></FONT></TD> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../../index.html?org/apache/velocity/tools/generic/DateTool.html" target="_top"><B>FRAMES</B></A> | |
<A HREF="DateTool.html" target="_top"><B>NO FRAMES</B></A> | |
<SCRIPT type="text/javascript"> | |
<!-- | |
if(window==top) { | |
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); | |
} | |
//--> | |
</SCRIPT> | |
<NOSCRIPT> | |
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> | |
</NOSCRIPT> | |
</FONT></TD> | |
</TR> | |
<TR> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> | |
</TR> | |
</TABLE> | |
<A NAME="skip-navbar_bottom"></A> | |
<!-- ======== END OF BOTTOM NAVBAR ======= --> | |
<HR> | |
Copyright (c) 2003-2007 Apache Software Foundation | |
</BODY> | |
</HTML> |