|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.util.DateUtils
public class DateUtils
Library for manipulating dates.
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_PATTERN
|
static java.lang.String |
MONTH_PATTERN
|
| Constructor Summary | |
|---|---|
DateUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
between(java.util.Date myDate,
java.util.Date beforeDate,
java.util.Date afterDate)
Check if the first date in argument is included between the two other dates. |
static java.util.Date |
createDate(int dd,
int mm,
int yy)
Create a new date from day, month and year (French version). |
static java.util.Date |
createDate(int s,
int m,
int h,
int dd,
int mm,
int yy)
Create a new date from day, month and year (French version). |
static java.util.Date |
createDateAfterToday(int ddStep,
int mmStep,
int yyStep)
Create a new date after the current date (today) with modification on day, month and year. |
static boolean |
currentPeriod(java.util.Date beforeDate,
java.util.Date afterDate)
Check if the current date is between the two dates in argument. |
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String pattern)
Format a date using the pattern in argument. |
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String pattern,
java.util.Locale locale)
|
static java.util.Calendar |
getDefaultCalendar(java.util.Date date)
Get the calendar corresponding to the date. |
static int |
getDifferenceInDays(java.util.Date beginDate,
java.util.Date endDate)
Do the difference between the two dates in argument. |
static int |
getDifferenceInHours(java.util.Date beginDate,
java.util.Date endDate)
Do the difference between the two dates in argument. |
static int |
getDifferenceInMinutes(java.util.Date beginDate,
java.util.Date endDate)
Do the difference between the two dates in argument. |
static int |
getDifferenceInMonths(java.util.Date beginDate,
java.util.Date endDate)
Do the difference between the two dates in argument. |
static int |
getDifferenceInSeconds(java.util.Date beginDate,
java.util.Date endDate)
Do the difference between the two dates in argument. |
static int |
getMonth(java.util.Date date)
Get the month value from a date (between 0 and 11). |
static java.lang.String |
getMonthLibelle(int monthNumber)
Get libelle of the month corresponding to the number given in argument. |
static java.lang.String |
getMonthLibelle(int monthNumber,
java.util.Locale locale)
Get libelle of the month corresponding to the number given in argument. |
static java.util.Date |
getYesterday(java.util.Date date)
Get the date before today |
static java.util.Date |
parseDate(java.lang.String date,
java.lang.String pattern)
Parse a date using the pattern in argument. |
static java.util.Date |
setFirstDayOfMonth(java.util.Date date)
Set the first day of month to the date in argument. |
static java.util.Date |
setLastDayOfMonth(java.util.Date date)
Set the last day of month to the date in argument. |
static java.util.Date |
setMaxTimeOfDay(java.util.Date date)
Set the max time of the day. |
static java.util.Date |
setMinTimeOfDay(java.util.Date date)
Set the min time of the day : 00:00:00.000. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DEFAULT_PATTERN
public static final java.lang.String MONTH_PATTERN
| Constructor Detail |
|---|
public DateUtils()
| Method Detail |
|---|
public static java.lang.String formatDate(java.util.Date date,
java.lang.String pattern)
date - the date to formatpattern - the pattern to use
DateFormat
public static java.lang.String formatDate(java.util.Date date,
java.lang.String pattern,
java.util.Locale locale)
public static java.util.Date parseDate(java.lang.String date,
java.lang.String pattern)
throws java.text.ParseException
date - the String to parsepattern - the pattern to use
java.text.ParseException - for parsing errorsDateFormat
public static java.util.Date createDate(int s,
int m,
int h,
int dd,
int mm,
int yy)
s - value of the seconds 1-60m - value of the minutes 1-60h - value of the hours 1-24dd - value of the day 1-31mm - value of the month 1-12yy - value of the year 0-9999
public static java.util.Date createDate(int dd,
int mm,
int yy)
dd - value of the day 1-31mm - value of the month 1-12yy - value of the year 0-9999
public static java.util.Date createDateAfterToday(int ddStep,
int mmStep,
int yyStep)
ddStep - nb days you want to increase from the current datemmStep - nb months you want to increase from the current dateyyStep - nb years you want to increase from the current date
public static java.util.Date setLastDayOfMonth(java.util.Date date)
date - Date to modify
public static java.util.Date setFirstDayOfMonth(java.util.Date date)
date - Date to modify
public static java.util.Date setMinTimeOfDay(java.util.Date date)
date - to modify
public static java.util.Date setMaxTimeOfDay(java.util.Date date)
date - to modify
public static boolean between(java.util.Date myDate,
java.util.Date beforeDate,
java.util.Date afterDate)
myDate - the date to testbeforeDate - the first date of the period to testafterDate - the second date of the period to test
public static boolean currentPeriod(java.util.Date beforeDate,
java.util.Date afterDate)
beforeDate - the first date of the periodafterDate - the second date of the period
between(Date, Date, Date)public static int getMonth(java.util.Date date)
date - the date to extract month
public static int getDifferenceInSeconds(java.util.Date beginDate,
java.util.Date endDate)
beginDate - first dateendDate - second date
public static int getDifferenceInMinutes(java.util.Date beginDate,
java.util.Date endDate)
beginDate - first dateendDate - second date
public static int getDifferenceInHours(java.util.Date beginDate,
java.util.Date endDate)
beginDate - first dateendDate - second date
public static int getDifferenceInDays(java.util.Date beginDate,
java.util.Date endDate)
beginDate - first dateendDate - second date
public static int getDifferenceInMonths(java.util.Date beginDate,
java.util.Date endDate)
beginDate - first dateendDate - second date
public static java.lang.String getMonthLibelle(int monthNumber,
java.util.Locale locale)
monthNumber - between 1-12locale - Locale for language support
public static java.lang.String getMonthLibelle(int monthNumber)
monthNumber - between 1-12
public static java.util.Date getYesterday(java.util.Date date)
date - concerned
public static java.util.Calendar getDefaultCalendar(java.util.Date date)
date. The default calendar
will be returned (default time zone and locale).
date - used to set the calendar time
date
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||