|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.lateralnz.common.util.DateUtils
public final class DateUtils
date formatting utilities
| Field Summary | |
|---|---|
static java.util.Date |
BEGINNING_OF_TIME
a constant representing the beginning of time (or 01/01/0001) |
static java.lang.String |
DAY_DATE_FORMAT
a constant format string for the day |
static java.util.Date |
END_OF_TIME
a constant representing the end of time (or 31/12/9999) |
static java.lang.String |
FRI
a constant representing "Fri" |
static java.lang.String |
MON
a constant representing "Mon" |
static java.lang.String |
MONTH_DATE_FORMAT
a constant format string for the month |
static long |
ONE_DAY_IN_MILLISECONDS
a constant for the number of milliseconds in a day |
static java.lang.String |
REVERSE_DATE_FORMAT
a constant format string for the reverse data (yyyyMMdd) |
static java.lang.String |
REVERSE_DATE_TIME_FORMAT
a constant format string for the date and tim (yyyyMMddhhmmss) |
static java.lang.String |
SAT
a constant representing "Sat" |
static java.lang.String |
SUN
a constant representing "Sun" |
static java.lang.String |
THURS
a constant representing "Thurs" |
static java.lang.String |
TUES
a constant representing "Tues" |
static java.lang.String |
WED
a constant representing "Wed" |
static java.lang.String |
YEAR_DATE_FORMAT
a constant format string for the year |
| Fields inherited from interface org.lateralnz.common.util.Constants |
|---|
AMPERSAND, AND, APPLICATION_X_WWW_FORM_URLENCODED, ASTERISK, AT, BACK_SLASH, CHAR_LEFT_CHEV, CHAR_RIGHT_CHEV, COLON, COMMA, CRLF, DASH, DELETE, DOLLAR, DOT, DOT_CLASS, DOT_JAVA, EIGHT, EMPTY, EQUALS, FALSE, FILE_SEPARATOR, FIVE, FORWARD_SLASH, FOUR, FULLSTOP, HASH, HAT, INSERT, LEFT_BRACE, LEFT_BRACKET, LEFT_CHEV, MAX_LEN_APPCODE, MAX_LEN_APPGROUP, MAX_LEN_MSGCODE, MAX_LEN_MSGTEXT, MINUS_ONE, N, NEWLINE, NINE, NO, NULL_STRING, OFF, ON, ONE, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_WEEK, PATH_SEPARATOR, PERCENT, PIPE, PLUS, QUESTION_MARK, QUOTE, REQUIRED, REQUIRES_NEW, RETURN, RIGHT_BRACE, RIGHT_BRACKET, RIGHT_CHEV, SELECT, SEMICOLON, SEVEN, SINGLE_QUOTE, SIX, SPACE, SQ_LEFT_BRACKET, SQ_RIGHT_BRACKET, SUPPORTS, TEXT_HTML, TEXT_PLAIN, TEXT_XML, THREE, TRUE, TWO, UNDERSCORE, UPDATE, UTF_8, Y, YES, ZERO |
| Method Summary | |
|---|---|
static java.util.Date |
add(java.util.Date date,
int field,
int amount)
add a value to a particular field (ie. |
static java.util.Date |
addDays(java.util.Date date,
int days)
add a number of days to a date (basically a wrapper call to "add") |
static java.util.Date |
applyTime(java.util.Date d,
java.lang.String time)
apply a string time value to a date object |
static java.lang.String |
formatDate(java.lang.String callerClassName,
java.util.Date d,
java.util.Locale locale,
java.lang.String pattern)
converts a date object into a string representation using a cached simpledateformat |
static java.lang.String |
formatDate(java.lang.String callerClassName,
java.util.Date d,
java.lang.String pattern)
converts a date object into a string representation using a cached simpledateformat |
static java.lang.String |
getCurrentMonthAsString()
Get a string representation of the month+year of current date. |
static java.util.List |
getDateRangeList(java.util.Date start,
java.util.Date end)
get a list of date objects starting from 'start' and finishing -before- 'end'. |
static int |
getDaysBetween(java.util.Date d1,
java.util.Date d2)
|
static java.lang.String |
getShortDay(java.util.Date date)
get a string representation of the day of the week the specified date represents |
static java.lang.String |
getShortDay(int dayOfWeek)
get a string representation of a day of week (eg. |
static java.util.Date |
getStartOfWeek(java.util.Date d)
get the first day of the week based upon the specified date (looks backwards from the date specified until it finds the monday) |
static boolean |
isEqualUsingPattern(java.lang.String callerClassName,
java.util.Date d1,
java.util.Date d2,
java.util.Locale locale,
java.lang.String pattern)
returns true if two dates are equal using a particular date pattern |
static boolean |
isEqualUsingPattern(java.lang.String callerClassName,
java.util.Date d1,
java.util.Date d2,
java.lang.String pattern)
returns true if two dates are equal using a particular date pattern |
static java.util.Date |
parseDate(java.lang.String callerClassName,
java.lang.String s,
java.util.Locale locale,
java.lang.String pattern)
turns a string representation of a date into a date object using a cached format |
static java.util.Date |
parseDate(java.lang.String callerClassName,
java.lang.String s,
java.lang.String pattern)
turns a string representation of a date into a date object using a cached format |
static java.util.Date |
setTime(java.lang.String callerClassName,
java.util.Date d,
java.lang.String time,
java.lang.String timeformat)
takes a date object and sets a time value against it |
| 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 MON
public static final java.lang.String TUES
public static final java.lang.String WED
public static final java.lang.String THURS
public static final java.lang.String FRI
public static final java.lang.String SAT
public static final java.lang.String SUN
public static final java.lang.String DAY_DATE_FORMAT
public static final java.lang.String MONTH_DATE_FORMAT
public static final java.lang.String YEAR_DATE_FORMAT
public static final java.lang.String REVERSE_DATE_FORMAT
public static final java.lang.String REVERSE_DATE_TIME_FORMAT
public static final long ONE_DAY_IN_MILLISECONDS
public static java.util.Date BEGINNING_OF_TIME
public static java.util.Date END_OF_TIME
| Method Detail |
|---|
public static final java.util.Date add(java.util.Date date,
int field,
int amount)
date - the date object to add tofield - the field of the date (see Calendar for fields)amount - the amount to add (or subtract if a negative number)
public static final java.util.Date addDays(java.util.Date date,
int days)
public static final java.util.Date applyTime(java.util.Date d,
java.lang.String time)
d - the date object to apply time totime - the time to apply as one of "hh", "hhmm" or "hhmmss"public static final java.lang.String getCurrentMonthAsString()
public static final java.util.List getDateRangeList(java.util.Date start,
java.util.Date end)
start - the date to start withend - the date to end with
public static final int getDaysBetween(java.util.Date d1,
java.util.Date d2)
public static final java.lang.String getShortDay(int dayOfWeek)
public static final java.lang.String getShortDay(java.util.Date date)
date - the date object to usepublic static final java.util.Date getStartOfWeek(java.util.Date d)
public static final java.lang.String formatDate(java.lang.String callerClassName,
java.util.Date d,
java.lang.String pattern)
callerClassName - the class of the object calling this method (used for caching)d - the date to convertpattern - the date format to use
public static final java.lang.String formatDate(java.lang.String callerClassName,
java.util.Date d,
java.util.Locale locale,
java.lang.String pattern)
callerClassName - the class of the object calling this method (used for caching)d - the date to convertlocale - the locale to use in conversionpattern - the date format to use
public static final java.util.Date parseDate(java.lang.String callerClassName,
java.lang.String s,
java.lang.String pattern)
throws java.text.ParseException
callerClassName - the class of the object calling this method (used for caching)s - the string date to convertpattern - the date format to use
java.text.ParseException
public static final java.util.Date parseDate(java.lang.String callerClassName,
java.lang.String s,
java.util.Locale locale,
java.lang.String pattern)
throws java.text.ParseException
callerClassName - the class of the object calling this method (used for caching)s - the string date to convertlocale - the locale to use in conversionpattern - the date format to use
java.text.ParseException
public static final boolean isEqualUsingPattern(java.lang.String callerClassName,
java.util.Date d1,
java.util.Date d2,
java.lang.String pattern)
throws java.text.ParseException
callerClassName - the class of the object calling this method (used for caching)d1 - the first dated2 - the second datepattern - the date format to compare the two date objects by
java.text.ParseException
public static final boolean isEqualUsingPattern(java.lang.String callerClassName,
java.util.Date d1,
java.util.Date d2,
java.util.Locale locale,
java.lang.String pattern)
throws java.text.ParseException
callerClassName - the class of the object calling this method (used for caching)d1 - the first dated2 - the second datelocale - the locale to use when comparing the datespattern - the date format to compare the two date objects by
java.text.ParseException
public static final java.util.Date setTime(java.lang.String callerClassName,
java.util.Date d,
java.lang.String time,
java.lang.String timeformat)
throws java.text.ParseException
callerClassName - the class of the object calling this method (used for caching)d - the date object to usetime - the string representation of the time to set on the date objecttimeformat - the format of the time
java.text.ParseException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||