|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pf.util.DateUtil
public class DateUtil
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
| Field Summary | |
|---|---|
static java.text.SimpleDateFormat |
DF_GERMAN_DATE
|
static java.text.SimpleDateFormat |
DF_GERMAN_DATE_TIME
|
static java.text.SimpleDateFormat |
DF_UK_DATE
|
static java.text.SimpleDateFormat |
DF_US_DATE
|
static java.util.TimeZone |
TIMEZONE_GERMANY
|
static java.util.TimeZone |
TIMEZONE_GMT
|
static java.util.TimeZone |
TIMEZONE_UTC
|
| Method Summary | |
|---|---|
java.util.Calendar |
asCalendar(java.util.Date date)
Returns the given date as Calendar in the current machines time zone. |
java.util.Calendar |
asCalendar(java.util.TimeZone timezone,
java.util.Date date)
Returns the given date as Calendar in the specified time zone. |
java.util.Calendar |
asGMTCalendar(java.util.Date date)
Returns the given date as Calendar in the GMT time zone. |
java.lang.String |
convertDateIntoZuluTime(java.util.Date date)
Converts the given date into the so-called zulu time. |
java.util.Date |
convertZuluTimeIntoDate(java.lang.String str)
Converts the given string that must be formatted as so-called zulu-time to a Date object. |
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 |
newDate(java.util.TimeZone timezone,
int year,
int month,
int day)
Returns a Date object representing the given parameters. |
java.util.Date |
newDate(java.util.TimeZone timezone,
int year,
int month,
int day,
int hour,
int minute,
int second)
Returns a Date object representing the given parameters. |
java.util.Date |
newGMTDate(int year,
int month,
int day,
int hour,
int minute,
int second)
Returns a Date object in time zone GMT 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 |
| Field Detail |
|---|
public static final java.util.TimeZone TIMEZONE_UTC
public static final java.util.TimeZone TIMEZONE_GMT
public static final java.util.TimeZone TIMEZONE_GERMANY
public static final java.text.SimpleDateFormat DF_GERMAN_DATE
public static final java.text.SimpleDateFormat DF_UK_DATE
public static final java.text.SimpleDateFormat DF_US_DATE
public static final java.text.SimpleDateFormat DF_GERMAN_DATE_TIME
| Method Detail |
|---|
public static DateUtil current()
public java.util.Date newDate(int year,
int month,
int day)
year - The year of the date to createmonth - The month of the date to create (1-based, 1=January)day - The day of the date to create
public java.util.Date newDate(java.util.TimeZone timezone,
int year,
int month,
int day)
timezone - The time zone to which the other parameters are relatedyear - The year of the date to createmonth - The month of the date to create (1-based, 1=January)day - The day of the date to create
public java.util.Date newDate(int year,
int month,
int day,
int hour,
int minute)
year - The year of the date to createmonth - The month of the date to create (1-based, 1=January)day - The day of the date to createhour - The hours (0-23)minute - The minutes (0-59)
public java.util.Date newDate(int year,
int month,
int day,
int hour,
int minute,
int second)
year - The year of the date to createmonth - The month of the date to create (1-based, 1=January)day - The day of the date to createhour - The hours (0-23)minute - The minutes (0-59)second - The seconds (0-59)
public java.util.Date newGMTDate(int year,
int month,
int day,
int hour,
int minute,
int second)
year - The year of the date to createmonth - The month of the date to create (1-based, 1=January)day - The day of the date to createhour - The hours (0-23)minute - The minutes (0-59)second - The seconds (0-59)
public java.util.Date newDate(java.util.TimeZone timezone,
int year,
int month,
int day,
int hour,
int minute,
int second)
timezone - The time zone to which the other parameters are relatedyear - The year of the date to createmonth - The month of the date to create (1-based, 1=January)day - The day of the date to createhour - The hours (0-23)minute - The minutes (0-59)second - The seconds (0-59)public java.util.Date today()
public java.util.Calendar asCalendar(java.util.Date date)
public java.util.Calendar asCalendar(java.util.TimeZone timezone,
java.util.Date date)
public java.util.Calendar asGMTCalendar(java.util.Date date)
public java.lang.String convertDateIntoZuluTime(java.util.Date date)
public java.util.Date convertZuluTimeIntoDate(java.lang.String str)
throws java.text.ParseException
java.text.ParseException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||