Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javatools.util
Class DateUtil  view DateUtil download DateUtil.java

java.lang.Object
  extended byjavatools.util.DateUtil

public class DateUtil
extends java.lang.Object

A utility class for use with dates.

Version:
0.7

Field Summary
(package private) static java.sql.Date _minusInfinity
          A pseudo-date representing -infinity.
(package private) static java.sql.Date _plusInfinity
          A pseudo-date representing +infinity.
(package private) static int FEB
          Contains 1 (representing February).
(package private) static int LEAP_DAYS_IN_FEB
          Contains 29.
 
Constructor Summary
DateUtil()
           
 
Method Summary
static int daysInMonth(int month, int year)
          Returns the number of days in a month depending on the year.
(package private) static void init()
          Initializes...
static boolean leapYear(int year)
          Checks if a year is a leap year.
static int maxMonthSize(int month)
          Returns the maximum value of days in a month.
static java.sql.Date minusInfinity()
          Return a date represting a long time in the past.
static int monthSize(int month)
          Returns the month size.
static java.sql.Date plusInfinity()
          Return a date representing a long time in the future.
static java.sql.Timestamp timestampNow()
          Return a Timestamp object representing the time now.
static boolean validDate(int date, int month, int year)
          Checks if a date is vald.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_minusInfinity

static java.sql.Date _minusInfinity
A pseudo-date representing -infinity.


_plusInfinity

static java.sql.Date _plusInfinity
A pseudo-date representing +infinity.


LEAP_DAYS_IN_FEB

static final int LEAP_DAYS_IN_FEB
Contains 29.

See Also:
Constant Field Values

FEB

static final int FEB
Contains 1 (representing February).

See Also:
Constant Field Values
Constructor Detail

DateUtil

public DateUtil()
Method Detail

minusInfinity

public static java.sql.Date minusInfinity()
Return a date represting a long time in the past.


plusInfinity

public static java.sql.Date plusInfinity()
Return a date representing a long time in the future. Sometimes people who don't like to use NULL values in databases use this as a kind of NULL value. Alternatively it can be sometimes useful in a SELECT to force use of an index.


timestampNow

public static java.sql.Timestamp timestampNow()
Return a Timestamp object representing the time now.


leapYear

public static boolean leapYear(int year)
Checks if a year is a leap year.


monthSize

public static int monthSize(int month)
Returns the month size.


maxMonthSize

public static int maxMonthSize(int month)
Returns the maximum value of days in a month.


daysInMonth

public static int daysInMonth(int month,
                              int year)
Returns the number of days in a month depending on the year. Month is zero based.


validDate

public static boolean validDate(int date,
                                int month,
                                int year)
Checks if a date is vald. month is zero based. date is not.


init

static void init()
Initializes...