Package org.apache.catalina.util
Class Strftime
- java.lang.Object
- 
- org.apache.catalina.util.Strftime
 
- 
 public class Strftime extends java.lang.ObjectConverts 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.- Author:
- Bip Thelin, Dan Sandberg
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.text.SimpleDateFormatsimpleDateFormatprotected static java.util.Propertiestranslate
 - 
Constructor SummaryConstructors Constructor Description Strftime(java.lang.String origFormat, java.util.Locale locale)Create an instance of this date formatting class
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringconvertDateFormat(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.Stringformat(java.util.Date date)Format the date according to the strftime-style string given in the constructor.java.util.TimeZonegetTimeZone()Get the timezone used for formatting conversionsprotected java.lang.Stringquote(java.lang.String str, boolean insideQuotes)voidsetTimeZone(java.util.TimeZone timeZone)Change the timezone used to format datesprotected booleantranslateCommand(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.
 
- 
- 
- 
Method Detail- 
formatpublic java.lang.String format(java.util.Date date) Format the date according to the strftime-style string given in the constructor.- Parameters:
- date- the date to format
- Returns:
- the formatted date
 
 - 
getTimeZonepublic java.util.TimeZone getTimeZone() Get the timezone used for formatting conversions- Returns:
- the timezone
 
 - 
setTimeZonepublic void setTimeZone(java.util.TimeZone timeZone) Change the timezone used to format dates- Parameters:
- timeZone- The new time zone
- See Also:
- DateFormat.setTimeZone(java.util.TimeZone)
 
 - 
convertDateFormatprotected 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.- Parameters:
- pattern- The pattern to search
- Returns:
- The modified pattern
 
 - 
quoteprotected java.lang.String quote(java.lang.String str, boolean insideQuotes)
 - 
translateCommandprotected 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.- Parameters:
- buf- The buffer
- pattern- The date/time pattern
- index- The char index
- oldInside- Flag value
- Returns:
- True if new is inside buffer
 
 
- 
 
-