public class DateUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.HashMap<java.lang.String,java.text.DateFormat> |
dateFormats |
static java.lang.String |
HHMM |
static java.lang.String |
HHMMSS |
static java.lang.String |
HHMMSSSS |
static long |
MILLISECONDS_IN_A_DAY |
static long |
MILLISECONDS_IN_A_WEEK |
static java.lang.String |
MMDDYY |
static java.lang.String |
MMDDYYHHMM |
static java.lang.String |
YYYY_MM_DD |
static java.lang.String |
YYYY_MM_DD_WITH_DASHES |
static java.lang.String |
YYYYMMDD |
Constructor and Description |
---|
DateUtil() |
Modifier and Type | Method and Description |
---|---|
static java.util.Date |
addWeeks(java.util.Date date,
int manyWeeks) |
static java.util.Date |
convertToEndOfDay(java.util.Date date) |
static java.util.Date |
convertToStartOfDay(java.util.Date date) |
static java.lang.String |
get(java.util.Date date) |
static java.lang.String |
get(java.util.Date date,
java.text.DateFormat dateFormat) |
static java.lang.String |
get(java.util.Date date,
java.lang.String pattern) |
static java.util.Calendar |
getCalendar(java.util.Date date) |
static java.util.Date |
getDate(java.lang.String format,
java.lang.String value) |
static java.lang.String |
getDateNow() |
static java.lang.String |
getDateNow(java.util.Date date) |
static java.lang.String |
getDateNow(java.util.Date date,
java.lang.String format) |
static java.lang.String |
getDateNow(java.lang.String format) |
static java.lang.String |
getDateStr(java.util.Date date,
java.lang.String format) |
static int |
getDifference(java.util.Date a,
java.util.Date b) |
static java.lang.String |
getHHMM(java.util.Date date) |
static java.lang.String |
getHHMMSS(java.util.Date date) |
static double |
getInterpolationRatioBetweenDates(java.util.Date startDate,
java.util.Date endDate,
java.util.Date interDate) |
static int |
getManyWeeksDifference(java.util.Date a,
java.util.Date b) |
static java.lang.String |
getMMDDYY(java.util.Date date) |
static java.lang.String |
getMMDDYYHHMM() |
static java.lang.String |
getMMDDYYHHMM(java.util.Date date) |
static java.util.Date |
getMondayAfter(java.util.Date date) |
static java.util.Date |
getMondayBefore(java.util.Date date) |
static java.util.Date |
getSentinalDate() |
static java.lang.String |
getTimeStamp() |
static int |
getWorkingDaysBetween(java.util.Calendar fromDate,
java.util.Calendar toDate) |
static int |
getWorkingDaysBetween(java.util.Date fromDate,
java.util.Date toDate) |
static java.lang.String |
getYYYYMMDD() |
static java.lang.String |
getYYYYMMDD(java.util.Date date) |
static boolean |
isWeekDay(java.util.Calendar cal) |
public static final long MILLISECONDS_IN_A_WEEK
public static final long MILLISECONDS_IN_A_DAY
public static final java.lang.String MMDDYY
public static final java.lang.String YYYYMMDD
public static final java.lang.String YYYY_MM_DD
public static final java.lang.String YYYY_MM_DD_WITH_DASHES
public static final java.lang.String MMDDYYHHMM
public static final java.lang.String HHMMSS
public static final java.lang.String HHMMSSSS
public static final java.lang.String HHMM
public static final java.util.HashMap<java.lang.String,java.text.DateFormat> dateFormats
public static java.util.Calendar getCalendar(java.util.Date date)
public static int getWorkingDaysBetween(java.util.Date fromDate, java.util.Date toDate)
public static boolean isWeekDay(java.util.Calendar cal)
public static java.util.Date getDate(java.lang.String format, java.lang.String value) throws java.text.ParseException
java.text.ParseException
public static int getWorkingDaysBetween(java.util.Calendar fromDate, java.util.Calendar toDate)
public static java.lang.String getHHMM(java.util.Date date)
public static java.lang.String getHHMMSS(java.util.Date date)
public static java.lang.String getYYYYMMDD()
public static java.lang.String getYYYYMMDD(java.util.Date date)
public static java.lang.String getMMDDYY(java.util.Date date)
public static java.lang.String getMMDDYYHHMM()
public static java.lang.String getMMDDYYHHMM(java.util.Date date)
public static java.lang.String getDateNow()
public static java.lang.String getDateNow(java.util.Date date)
public static java.lang.String getTimeStamp()
public static java.lang.String getDateStr(java.util.Date date, java.lang.String format)
public static java.lang.String getDateNow(java.lang.String format)
public static java.lang.String getDateNow(java.util.Date date, java.lang.String format)
public static java.lang.String get(java.util.Date date)
public static java.lang.String get(java.util.Date date, java.lang.String pattern)
public static java.lang.String get(java.util.Date date, java.text.DateFormat dateFormat)
public static int getDifference(java.util.Date a, java.util.Date b)
public static double getInterpolationRatioBetweenDates(java.util.Date startDate, java.util.Date endDate, java.util.Date interDate)
startDate
- The first date of the interpolation. MUST be before endDate.endDate
- The last date of the interpolation. MUST be after startDateinterDate
- The date between startDate and endDate.public static java.util.Date addWeeks(java.util.Date date, int manyWeeks)
public static int getManyWeeksDifference(java.util.Date a, java.util.Date b)
a
- One date. Sequential order with other date parameter does not matter.b
- Another date. Sequential order with other date parameter does not matter.public static java.util.Date getMondayBefore(java.util.Date date)
public static java.util.Date getMondayAfter(java.util.Date date)
public static java.util.Date convertToStartOfDay(java.util.Date date)
public static java.util.Date convertToEndOfDay(java.util.Date date)
public static java.util.Date getSentinalDate()