|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 SimpleDateFormat |
simpleDateFormat
|
protected static Properties |
translate
|
Constructor Summary | |
---|---|
Strftime(String origFormat)
Create an instance of this date formatting class |
|
Strftime(String origFormat,
Locale locale)
Create an instance of this date formatting class |
Method Summary | |
---|---|
protected String |
convertDateFormat(String pattern)
Search the provided pattern and get the C standard Date/Time formatting rules and convert them to the Java equivalent. |
String |
format(Date date)
Format the date according to the strftime-style string given in the constructor. |
TimeZone |
getTimeZone()
Get the timezone used for formatting conversions |
protected String |
quote(String str,
boolean insideQuotes)
|
void |
setTimeZone(TimeZone timeZone)
Change the timezone used to format dates |
protected boolean |
translateCommand(StringBuilder buf,
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 Properties translate
protected SimpleDateFormat simpleDateFormat
Constructor Detail |
---|
public Strftime(String origFormat)
Strftime( String, Locale )
public Strftime(String origFormat, Locale locale)
origFormat
- the strftime-style formatting stringlocale
- the locale to use for locale-specific conversionsMethod Detail |
---|
public String format(Date date)
date
- the date to format
public TimeZone getTimeZone()
public void setTimeZone(TimeZone timeZone)
DateFormat.setTimeZone(java.util.TimeZone)
protected String convertDateFormat(String pattern)
pattern
- The pattern to search
protected String quote(String str, boolean insideQuotes)
protected boolean translateCommand(StringBuilder buf, String pattern, int index, boolean oldInside)
buf
- The bufferpattern
- The date/time patternindex
- The char indexoldInside
- Flag value
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |