org.apache.derby.iapi.util
Class CheapDateFormatter

java.lang.Object
  extended by 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.


Field Summary
(package private) static long DAYS
           
(package private) static int[] DAYS_IN_MONTH
           
(package private) static long END_OF_FIRST_YEAR
           
(package private) static long END_OF_SECOND_YEAR
           
(package private) static long END_OF_THIRD_YEAR
           
(package private) static int FEBRUARY
           
(package private) static long FOURYEARS
           
(package private) static long HOURS
           
(package private) static long LEAP_YEAR
           
(package private) static long MINUTES
           
(package private) static long NORMAL_YEAR
           
(package private) static long SECONDS
           
 
Constructor Summary
CheapDateFormatter()
           
 
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
 

Field Detail

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
Constructor Detail

CheapDateFormatter

public CheapDateFormatter()
Method Detail

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)

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.