org.pf.util
Class DateUtil

java.lang.Object
  extended by org.pf.util.DateUtil

public class DateUtil
extends java.lang.Object

This class is intended to provide convenience methods around the java.util.Date class. It is not always necessary to fiddle around with the awkward GregorianCalendar and not everybody wants to use the deprecated methods of java.util.Date.

Be aware that this class always treats months 1-based NOT zero-based. That is: 1=January, 2=February, 3=March, ..., 12=December

Version:
1.0
Author:
Manfred Duchrow

Method Summary
static DateUtil current()
          Returns the only instance this class supports (design pattern "Singleton")
 java.util.Date newDate(int year, int month, int day)
          Returns a Date object representing the given parameters.
 java.util.Date newDate(int year, int month, int day, int hour, int minute)
          Returns a Date object representing the given parameters.
 java.util.Date newDate(int year, int month, int day, int hour, int minute, int second)
          Returns a Date object representing the given parameters.
 java.util.Date today()
          Returns the current date
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

current

public static DateUtil current()
Returns the only instance this class supports (design pattern "Singleton")


newDate

public java.util.Date newDate(int year,
                              int month,
                              int day)
Returns a Date object representing the given parameters.

Parameters:
year - The year of the date to create
month - The month of the date to create (1-based, 1=January)
day - The day of the date to create

newDate

public java.util.Date newDate(int year,
                              int month,
                              int day,
                              int hour,
                              int minute)
Returns a Date object representing the given parameters.

Parameters:
year - The year of the date to create
month - The month of the date to create (1-based, 1=January)
day - The day of the date to create
hour - The hours (0-23)
minute - The minutes (0-59)

newDate

public java.util.Date newDate(int year,
                              int month,
                              int day,
                              int hour,
                              int minute,
                              int second)
Returns a Date object representing the given parameters.

Parameters:
year - The year of the date to create
month - The month of the date to create (1-based, 1=January)
day - The day of the date to create
hour - The hours (0-23)
minute - The minutes (0-59)
second - The seconds (0-59)

today

public java.util.Date today()
Returns the current date