Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.util
Class Strftime

    java.lang.Object
      org.apache.catalina.util.Strftime

public class Strftime
extends java.lang.Object

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.

Version:
  $Revision: 1.1.1.1 $, $Date: 2002/07/18 16:47:47 $
Author:
  Bip Thelin, Dan Sandberg

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.StringBuffer buf, java.lang.String pattern, int index, boolean oldInside)` try to get the Java Date/Time formating 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

### translate

    protected static java.util.Properties translate

### simpleDateFormat

    protected java.text.SimpleDateFormat simpleDateFormat

Constructor Detail

### Strftime

    public Strftime(java.lang.String origFormat)

  Create an instance of this date formatting class

See Also:
  `Strftime( String, Locale )`

### Strftime

    public Strftime(java.lang.String origFormat,
                    java.util.Locale locale)

  Create an instance of this date formatting class

Parameters:
  `origFormat` - the strftime-style formatting string

Method Detail

### format

    public 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

### getTimeZone

    public java.util.TimeZone getTimeZone()

  Get the timezone used for formatting conversions

  Returns:
    the timezone

### setTimeZone

    public void setTimeZone(java.util.TimeZone timeZone)

  Change the timezone used to format dates

  See Also:
    `java.util.TimeZone#setTimeZone`

### convertDateFormat

    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.

  Parameters:
    `pattern` - The pattern to search
  Returns:
    The modified pattern

### quote

    protected java.lang.String quote(java.lang.String str,
                                     boolean insideQuotes)

### translateCommand

    protected boolean translateCommand(java.lang.StringBuffer buf,
                                       java.lang.String pattern,
                                       int index,
                                       boolean oldInside)

  try to get the Java Date/Time formating associated with the C standard provided

  Returns:
    The Java formatting rule to use

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.