|
||||||||||
| 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 String |
DEFAULT_PATTERN
|
static String |
MONTH_PATTERN
|
| Constructor Summary | |
|---|---|
DateUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
between(Date myDate,
Date beforeDate,
Date afterDate)
Check if the first date in argument is included between the two other dates. |
static Date |
createDate(int dd,
int mm,
int yy)
Create a new date from day, month and year (French version). |
static 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 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(Date beforeDate,
Date afterDate)
Check if the current date is between the two dates in argument. |
static String |
formatDate(Date date,
String pattern)
Format a date using the pattern in argument. |
static String |
formatDate(Date date,
String pattern,
Locale locale)
|
static Calendar |
getDefaultCalendar(Date date)
Get the calendar corresponding to the date. |
static int |
getDifferenceInDays(Date beginDate,
Date endDate)
Do the difference between the two dates in argument. |
static int |
getDifferenceInHours(Date beginDate,
Date endDate)
Do the difference between the two dates in argument. |
static int |
getDifferenceInMinutes(Date beginDate,
Date endDate)
Do the difference between the two dates in argument. |
static int |
getDifferenceInMonths(Date beginDate,
Date endDate)
Do the difference between the two dates in argument. |
static int |
getDifferenceInSeconds(Date beginDate,
Date endDate)
Do the difference between the two dates in argument. |
static int |
getMonth(Date date)
Get the month value from a date (between 0 and 11). |
static String |
getMonthLibelle(int monthNumber)
Get libelle of the month corresponding to the number given in argument. |
static String |
getMonthLibelle(int monthNumber,
Locale locale)
Get libelle of the month corresponding to the number given in argument. |
static Date |
getYesterday(Date date)
Get the date before today |
static Date |
parseDate(String date,
String pattern)
Parse a date using the pattern in argument. |
static Date |
setFirstDayOfMonth(Date date)
Set the first day of month to the date in argument. |
static Date |
setLastDayOfMonth(Date date)
Set the last day of month to the date in argument. |
static Date |
setMaxTimeOfDay(Date date)
Set the max time of the day. |
static Date |
setMinTimeOfDay(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 String DEFAULT_PATTERN
public static final String MONTH_PATTERN
| Constructor Detail |
|---|
public DateUtils()
| Method Detail |
|---|
public static String formatDate(Date date,
String pattern)
date - the date to formatpattern - the pattern to use
DateFormat
public static String formatDate(Date date,
String pattern,
Locale locale)
public static Date parseDate(String date,
String pattern)
throws ParseException
date - the String to parsepattern - the pattern to use
ParseException - for parsing errorsDateFormat
public static 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 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 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 Date setLastDayOfMonth(Date date)
date - Date to modify
public static Date setFirstDayOfMonth(Date date)
date - Date to modify
public static Date setMinTimeOfDay(Date date)
date - to modify
public static Date setMaxTimeOfDay(Date date)
date - to modify
public static boolean between(Date myDate,
Date beforeDate,
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(Date beforeDate,
Date afterDate)
beforeDate - the first date of the periodafterDate - the second date of the period
between(Date, Date, Date)public static int getMonth(Date date)
date - the date to extract month
public static int getDifferenceInSeconds(Date beginDate,
Date endDate)
beginDate - first dateendDate - second date
public static int getDifferenceInMinutes(Date beginDate,
Date endDate)
beginDate - first dateendDate - second date
public static int getDifferenceInHours(Date beginDate,
Date endDate)
beginDate - first dateendDate - second date
public static int getDifferenceInDays(Date beginDate,
Date endDate)
beginDate - first dateendDate - second date
public static int getDifferenceInMonths(Date beginDate,
Date endDate)
beginDate - first dateendDate - second date
public static String getMonthLibelle(int monthNumber,
Locale locale)
monthNumber - between 1-12locale - Locale for language support
public static String getMonthLibelle(int monthNumber)
monthNumber - between 1-12
public static Date getYesterday(Date date)
date - concerned
public static Calendar getDefaultCalendar(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 | |||||||||