|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ujac.util.DateUtils
public class DateUtils
Name: DateUtils
Description: Provides calendar and date utilities for more convenient date handling.
Constructor Summary | |
---|---|
DateUtils()
|
Method Summary | |
---|---|
static Date |
beginOfYear(Date d)
Gets the begin of year for the given date. |
static Calendar |
createCalendar(Date date)
Creates a Calendar instance for the given date. |
static Calendar |
createCalendar(Date date,
int precision)
Creates a Calendar instance for the given date. |
static Calendar |
createCalendar(int precision)
Creates a Calendar instance for the current time. |
static Calendar |
createCalendar(int year,
int month,
int day)
Creates a Calendar instance for the given arguments. |
static Calendar |
createCalendar(int year,
int month,
int day,
int hour,
int minute,
int second)
Creates a Calendar instance for the given arguments. |
static Calendar |
createCalendar(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
Creates a Calendar instance for the given arguments. |
static Date |
createDate(int year,
int month,
int day)
Creates a Date instance for the given arguments. |
static Date |
createDate(int year,
int month,
int day,
int hour,
int minute,
int second)
Creates a Date instance for the given arguments. |
static Date |
createDate(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
Creates a Date instance for the given arguments. |
static Date |
endOfYear(Date d)
Gets the end of year for the given date. |
static int |
getDay(Calendar cal)
Gets the day of month from the given calendar. |
static int |
getDay(Date date)
Gets the day of month from the given date. |
static int |
getHour(Calendar cal)
Gets the millisecond from the given calendar. |
static int |
getHour(Date date)
Gets the millisecond from the given date. |
static int |
getMillisecond(Calendar cal)
Gets the millisecond from the given calendar. |
static int |
getMillisecond(Date date)
Gets the millisecond from the given calendar. |
static int |
getMinute(Calendar cal)
Gets the minute from the given calendar. |
static int |
getMinute(Date date)
Gets the minute from the given date. |
static int |
getMonth(Calendar cal)
Gets the month from the given calendar. |
static int |
getMonth(Date date)
Gets the month from the given date. |
static int |
getSecond(Calendar cal)
Gets the second from the given calendar. |
static int |
getSecond(Date date)
Gets the second from the given date. |
static int |
getYear(Calendar cal)
Gets the year from the given calendar. |
static int |
getYear(Date date)
Gets the year from the given date. |
static void |
incrDay(Calendar cal,
int days)
Increments the given calendar by the given amount of days. |
static Date |
incrDay(Date date,
int days)
Increments the given date by the given amount of days. |
static void |
incrHour(Calendar cal,
int hours)
Increments the given calendar by the given amount of hours. |
static Date |
incrHour(Date date,
int hours)
Increments the given date by the given amount of hours. |
static void |
incrMillisecond(Calendar cal,
int milliseconds)
Increments the given calendar by the given amount of milliseconds. |
static Date |
incrMillisecond(Date date,
int milliseconds)
Increments the given calendar by the given amount of milliseconds. |
static void |
incrMinute(Calendar cal,
int minutes)
Increments the given calendar by the given amount of minutes. |
static Date |
incrMinute(Date date,
int minutes)
Increments the given date by the given amount of minutes. |
static void |
incrMonth(Calendar cal,
int months)
Increments the given calendar by the given amount of months. |
static Date |
incrMonth(Date date,
int months)
Increments the given date by the given amount of months. |
static void |
incrSecond(Calendar cal,
int seconds)
Increments the given calendar by the given amount of seconds. |
static Date |
incrSecond(Date date,
int seconds)
Increments the given date by the given amount of seconds. |
static void |
incrYear(Calendar cal,
int years)
Increments the given calendar by the given amount of years. |
static Date |
incrYear(Date date,
int year)
Increments the given date by the given amount of years. |
static Date |
max(Date a,
Date b)
Gets the minimum of the given two date values. |
static Date |
min(Date a,
Date b)
Gets the minimum of the given two date values. |
static Date |
nextUltimo(Date d)
Gets the next ultimo for the given date. |
static Date |
now()
Gets the current time. |
static Date |
now(int precision)
Gets the current time. |
static Date |
previousUltimo(Date d)
Gets the previous ultimo for the given date. |
static void |
setDay(Calendar cal,
int day)
Sets the day of month at the given calendar. |
static Date |
setDay(Date date,
int day)
Sets the day of month at the given date. |
static void |
setHour(Calendar cal,
int hour)
Sets the millisecond at the given calendar. |
static Date |
setHour(Date date,
int hour)
Sets the millisecond at the given date. |
static void |
setMillisecond(Calendar cal,
int millisecond)
Sets the millisecond at the given calendar. |
static Date |
setMillisecond(Date date,
int millisecond)
Sets the millisecond at the given calendar. |
static void |
setMinute(Calendar cal,
int minute)
Sets the minute at the given calendar. |
static Date |
setMinute(Date date,
int minute)
Sets the minute at the given date. |
static void |
setMonth(Calendar cal,
int month)
Sets the month at the given calendar. |
static Date |
setMonth(Date date,
int month)
Sets the month at the given date. |
static void |
setSecond(Calendar cal,
int second)
Sets the second at the given calendar. |
static Date |
setSecond(Date date,
int second)
Sets the second at the given date. |
static void |
setYear(Calendar cal,
int year)
Sets the year at the given calendar. |
static Date |
setYear(Date date,
int year)
Sets the year at the given date. |
static Date |
today()
Gets the current date. |
static Date |
yesterday()
Gets the current date -1 day. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateUtils()
Method Detail |
---|
public static final Date today()
public static final Date yesterday()
public static final Date now()
public static final Date now(int precision)
precision
- The ID of the most precise value of interest.
Calendar.MILLISECOND
,
Calendar.SECOND
,
Calendar.MINUTE
,
Calendar.HOUR
public static final Calendar createCalendar(int year, int month, int day)
year
- The year to set.month
- The month to set.day
- The day to set.
public static final Calendar createCalendar(int year, int month, int day, int hour, int minute, int second)
year
- The year to set.month
- The month to set.day
- The day to set.hour
- The hour to set.minute
- The minute to set.second
- The second to set.
public static final Calendar createCalendar(int year, int month, int day, int hour, int minute, int second, int millisecond)
year
- The year to set.month
- The month to set.day
- The day to set.hour
- The hour to set.minute
- The minute to set.second
- The second to set.millisecond
- The millisecond to set.
public static final Calendar createCalendar(Date date)
date
- The date to set for the new calendar.
public static final Calendar createCalendar(int precision)
precision
- The ID of the most precise value of interest.
Calendar.MILLISECOND
,
Calendar.SECOND
,
Calendar.MINUTE
,
Calendar.HOUR
public static final Calendar createCalendar(Date date, int precision)
date
- The date to set for the new calendar.precision
- The ID of the most precise value of interest.
Calendar.MILLISECOND
,
Calendar.SECOND
,
Calendar.MINUTE
,
Calendar.HOUR
public static final Date createDate(int year, int month, int day)
year
- The year to set.month
- The month to set.day
- The day to set.
public static final Date createDate(int year, int month, int day, int hour, int minute, int second)
year
- The year to set.month
- The month to set.day
- The day to set.hour
- The hour to set.minute
- The minute to set.second
- The second to set.
public static final Date createDate(int year, int month, int day, int hour, int minute, int second, int millisecond)
year
- The year to set.month
- The month to set.day
- The day to set.hour
- The hour to set.minute
- The minute to set.second
- The second to set.millisecond
- The millisecond to set.
public static final int getDay(Calendar cal)
cal
- The calendar to get the current day of month from.
public static final int getDay(Date date)
date
- The date to get the current day of month from.
public static final void setDay(Calendar cal, int day)
cal
- The calendar to set the current day of month at.day
- The day of month to set for the calendar.public static final Date setDay(Date date, int day)
date
- The calendar to set the current day of month at.day
- The day of month to set for the date.
public static final void incrDay(Calendar cal, int days)
cal
- The calendar to alter.days
- The number of days to add to the calendar.public static final Date incrDay(Date date, int days)
date
- The date to alter.days
- The number of days to add to the date.
public static final int getMonth(Calendar cal)
cal
- The calendar to get the current month from.
public static final int getMonth(Date date)
date
- The date to get the current month from.
public static final void setMonth(Calendar cal, int month)
cal
- The calendar to set the current month at.month
- The month to set for the calendar.public static final Date setMonth(Date date, int month)
date
- The calendar to set the current month at.month
- The month to set to the date.
public static final void incrMonth(Calendar cal, int months)
cal
- The calendar to alter.months
- The number of months to add to the calendar.public static final Date incrMonth(Date date, int months)
date
- The date to alter.months
- The number of months to add to the date.
public static final int getYear(Calendar cal)
cal
- The calendar to get the current year from.
public static final int getYear(Date date)
date
- The date to get the current year from.
public static final void setYear(Calendar cal, int year)
cal
- The calendar to set the current year at.year
- The year to set for the calendar.public static final Date setYear(Date date, int year)
date
- The date to set the current year at.year
- The year to set for the date.
public static final void incrYear(Calendar cal, int years)
cal
- The calendar to alter.years
- The number of years to add to the calendar.public static final Date incrYear(Date date, int year)
date
- The calendar to set the current year at.year
- The year to set for the date.
public static final int getHour(Calendar cal)
cal
- The calendar to get the current millisecond from.
public static final int getHour(Date date)
date
- The date to get the current millisecond from.
public static final void setHour(Calendar cal, int hour)
cal
- The calendar to set the current millisecond at.hour
- The hour to set for the calendar.public static final Date setHour(Date date, int hour)
date
- The date to set the current millisecond at.hour
- The hour to set for the calendar.
public static final void incrHour(Calendar cal, int hours)
cal
- The calendar to alter.hours
- The number of hours to add to the calendar.public static final Date incrHour(Date date, int hours)
date
- The date to alter.hours
- The number of hours to add to the calendar.
public static final int getMinute(Calendar cal)
cal
- The calendar to get the current minute from.
public static final int getMinute(Date date)
date
- The date to get the current minute from.
public static final void setMinute(Calendar cal, int minute)
cal
- The calendar to set the current minute at.minute
- The minute to set for the calendar.public static final Date setMinute(Date date, int minute)
date
- The date to set the current minute at.minute
- The minute to set for the date.
public static final void incrMinute(Calendar cal, int minutes)
cal
- The calendar to alter.minutes
- The number of minutes to add to the calendar.public static final Date incrMinute(Date date, int minutes)
date
- The date to alter.minutes
- The number of minutes to add to the date.
public static final int getSecond(Calendar cal)
cal
- The calendar to get the current second from.
public static final int getSecond(Date date)
date
- The date to get the current second from.
public static final void setSecond(Calendar cal, int second)
cal
- The calendar to set the current second at.second
- The second to set for the calendar.public static final Date setSecond(Date date, int second)
date
- The date to set the current second at.second
- The second to set for the date.
public static final void incrSecond(Calendar cal, int seconds)
cal
- The calendar to alter.seconds
- The number of seconds to add to the calendar.public static final Date incrSecond(Date date, int seconds)
date
- The date to alter.seconds
- The number of seconds to add to the calendar.
public static final int getMillisecond(Calendar cal)
cal
- The calendar to get the current millisecond from.
public static final int getMillisecond(Date date)
date
- The date to get the current millisecond from.
public static final void setMillisecond(Calendar cal, int millisecond)
cal
- The calendar to set the current millisecond at.millisecond
- The millisecond to set for the calendar.public static final Date setMillisecond(Date date, int millisecond)
date
- The date to set the current millisecond at.millisecond
- The millisecond to set for the calendar.
public static final void incrMillisecond(Calendar cal, int milliseconds)
cal
- The calendar to alter.milliseconds
- The number of milliseconds to add to the calendar.public static final Date incrMillisecond(Date date, int milliseconds)
date
- The date to alter.milliseconds
- The number of milliseconds to add to the calendar.
public static final Date min(Date a, Date b)
a
- The first date.b
- The second date.
public static final Date max(Date a, Date b)
a
- The first date.b
- The second date.
public static final Date beginOfYear(Date d)
d
- The date to process.
public static final Date endOfYear(Date d)
d
- The date to process.
public static final Date previousUltimo(Date d)
d
- The date to process.
public static final Date nextUltimo(Date d)
d
- The date to process.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |