|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.catalina.util.Strftime
public class Strftime
Converts dates to strings using the same format specifiers as strftime Note: This does not mimic strftime perfectly. Certain strftime commands, are not supported, and will convert as if they were literals. Certain complicated commands, like those dealing with the week of the year probably don't have exactly the same behavior as strftime. These limitations are due to use SimpleDateTime. If the conversion was done manually, all these limitations could be eliminated. The interface looks like a subset of DateFormat. Maybe someday someone will make this class extend DateFormat.
Field Summary | |
---|---|
protected java.text.SimpleDateFormat |
simpleDateFormat
|
protected static java.util.Properties |
translate
|
Constructor Summary | |
---|---|
Strftime(java.lang.String origFormat)
Create an instance of this date formatting class |
|
Strftime(java.lang.String origFormat,
java.util.Locale locale)
Create an instance of this date formatting class |
Method Summary | |
---|---|
protected java.lang.String |
convertDateFormat(java.lang.String pattern)
Search the provided pattern and get the C standard Date/Time formatting rules and convert them to the Java equivalent. |
java.lang.String |
format(java.util.Date date)
Format the date according to the strftime-style string given in the constructor. |
java.util.TimeZone |
getTimeZone()
Get the timezone used for formatting conversions |
protected java.lang.String |
quote(java.lang.String str,
boolean insideQuotes)
|
void |
setTimeZone(java.util.TimeZone timeZone)
Change the timezone used to format dates |
protected boolean |
translateCommand(java.lang.StringBuilder buf,
java.lang.String pattern,
int index,
boolean oldInside)
Try to get the Java Date/Time formatting associated with the C standard provided. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.Properties translate
protected java.text.SimpleDateFormat simpleDateFormat
Constructor Detail |
---|
public Strftime(java.lang.String origFormat)
Strftime( String, Locale )
public Strftime(java.lang.String origFormat, java.util.Locale locale)
origFormat
- the strftime-style formatting stringlocale
- the locale to use for locale-specific conversionsMethod Detail |
---|
public java.lang.String format(java.util.Date date)
date
- the date to format
public java.util.TimeZone getTimeZone()
public void setTimeZone(java.util.TimeZone timeZone)
DateFormat.setTimeZone(java.util.TimeZone)
protected java.lang.String convertDateFormat(java.lang.String pattern)
pattern
- The pattern to search
protected java.lang.String quote(java.lang.String str, boolean insideQuotes)
protected boolean translateCommand(java.lang.StringBuilder buf, java.lang.String pattern, int index, boolean oldInside)
buf
- The bufferpattern
- The date/time patternindex
- The char indexoldInside
- Flag value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |