org.apache.derby.iapi.util
Class CheapDateFormatter
java.lang.Object
org.apache.derby.iapi.util.CheapDateFormatter
- public class CheapDateFormatter
- extends java.lang.Object
This class contains static methods for formatting dates into Strings.
It can be used where standard Date formatting is judged to be too
expensive.
Method Summary |
static java.lang.String |
formatDate(long time)
This method formats the current date into a String. |
private static java.lang.String |
threeDigits(long val)
|
private static java.lang.String |
twoDigits(long val)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SECONDS
static final long SECONDS
- See Also:
- Constant Field Values
MINUTES
static final long MINUTES
- See Also:
- Constant Field Values
HOURS
static final long HOURS
- See Also:
- Constant Field Values
DAYS
static final long DAYS
- See Also:
- Constant Field Values
NORMAL_YEAR
static final long NORMAL_YEAR
- See Also:
- Constant Field Values
LEAP_YEAR
static final long LEAP_YEAR
- See Also:
- Constant Field Values
FOURYEARS
static final long FOURYEARS
- See Also:
- Constant Field Values
END_OF_FIRST_YEAR
static final long END_OF_FIRST_YEAR
- See Also:
- Constant Field Values
END_OF_SECOND_YEAR
static final long END_OF_SECOND_YEAR
- See Also:
- Constant Field Values
END_OF_THIRD_YEAR
static final long END_OF_THIRD_YEAR
- See Also:
- Constant Field Values
DAYS_IN_MONTH
static final int[] DAYS_IN_MONTH
FEBRUARY
static final int FEBRUARY
- See Also:
- Constant Field Values
CheapDateFormatter
public CheapDateFormatter()
formatDate
public static java.lang.String formatDate(long time)
- This method formats the current date into a String. The input is
a long representing the number of milliseconds since Jan. 1, 1970.
The output is a String in the form yyyy/mm/dd hh:mm:ss.ddd GMT.
The purpose of this class is to format date strings without paying
the price of instantiating ResourceBundles and Locales, which the
java.util.Date class does whenever you format a date string.
As a result, the output of this class is not localized, it does
not take the local time zone into account, and it is possible that
it will not be as accurate as the standard Date class. It is OK
to use this method when, for example, formatting timestamps to
write to db2j.LOG, but not for manipulating dates in language
processing.
- Parameters:
time
- The current time in milliseconds since Jan. 1, 1970
- Returns:
- The date formatted as yyyy/mm/dd hh:mm:ss.ddd GMT.
twoDigits
private static java.lang.String twoDigits(long val)
threeDigits
private static java.lang.String threeDigits(long val)
Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.