| java.lang.Object org.lateralnz.common.util.DateUtils
DateUtils | final public class DateUtils implements Constants(Code) | | date formatting utilities
author: J R Briggs |
Method Summary | |
final public static Date | add(Date date, int field, int amount) add a value to a particular field (ie. | final public static Date | addDays(Date date, int days) | final public static Date | applyTime(Date d, String time) | final public static String | formatDate(String callerClassName, Date d, String pattern) | final public static String | formatDate(String callerClassName, Date d, Locale locale, String pattern) | final public static String | getCurrentMonthAsString() Get a string representation of the month+year of current date. | final public static List | getDateRangeList(Date start, Date end) get a list of date objects starting from 'start' and finishing -before- 'end'. | final public static int | getDaysBetween(Date d1, Date d2) | final public static String | getShortDay(int dayOfWeek) get a string representation of a day of week (eg. | final public static String | getShortDay(Date date) | final public static Date | getStartOfWeek(Date d) | final public static boolean | isEqualUsingPattern(String callerClassName, Date d1, Date d2, String pattern) | final public static boolean | isEqualUsingPattern(String callerClassName, Date d1, Date d2, Locale locale, String pattern) | final public static Date | parseDate(String callerClassName, String s, String pattern) | final public static Date | parseDate(String callerClassName, String s, Locale locale, String pattern) | final public static Date | setTime(String callerClassName, Date d, String time, String timeformat) |
BEGINNING_OF_TIME | public static Date BEGINNING_OF_TIME(Code) | | a constant representing the beginning of time (or 01/01/0001)
|
DAY_DATE_FORMAT | final public static String DAY_DATE_FORMAT(Code) | | a constant format string for the day
|
END_OF_TIME | public static Date END_OF_TIME(Code) | | a constant representing the end of time (or 31/12/9999)
|
FRI | final public static String FRI(Code) | | a constant representing "Fri"
|
MON | final public static String MON(Code) | | a constant representing "Mon"
|
MONTH_DATE_FORMAT | final public static String MONTH_DATE_FORMAT(Code) | | a constant format string for the month
|
ONE_DAY_IN_MILLISECONDS | final public static long ONE_DAY_IN_MILLISECONDS(Code) | | a constant for the number of milliseconds in a day
|
REVERSE_DATE_FORMAT | final public static String REVERSE_DATE_FORMAT(Code) | | a constant format string for the reverse data (yyyyMMdd)
|
REVERSE_DATE_TIME_FORMAT | final public static String REVERSE_DATE_TIME_FORMAT(Code) | | a constant format string for the date and tim (yyyyMMddhhmmss)
|
SAT | final public static String SAT(Code) | | a constant representing "Sat"
|
SUN | final public static String SUN(Code) | | a constant representing "Sun"
|
THURS | final public static String THURS(Code) | | a constant representing "Thurs"
|
TUES | final public static String TUES(Code) | | a constant representing "Tues"
|
WED | final public static String WED(Code) | | a constant representing "Wed"
|
YEAR_DATE_FORMAT | final public static String YEAR_DATE_FORMAT(Code) | | a constant format string for the year
|
add | final public static Date add(Date date, int field, int amount)(Code) | | add a value to a particular field (ie. day, month, year) of a date. Note: if you
want to subtract, then add -1, -2, etc
Parameters: date - the date object to add to Parameters: field - the field of the date (see Calendar for fields) Parameters: amount - the amount to add (or subtract if a negative number) a new date object |
addDays | final public static Date addDays(Date date, int days)(Code) | | add a number of days to a date (basically a wrapper call to "add")
|
applyTime | final public static Date applyTime(Date d, String time)(Code) | | apply a string time value to a date object
Parameters: d - the date object to apply time to Parameters: time - the time to apply as one of "hh", "hhmm" or "hhmmss" |
formatDate | final public static String formatDate(String callerClassName, Date d, String pattern)(Code) | | converts a date object into a string representation using a cached simpledateformat
Parameters: callerClassName - the class of the object calling this method (used for caching) Parameters: d - the date to convert Parameters: pattern - the date format to use |
formatDate | final public static String formatDate(String callerClassName, Date d, Locale locale, String pattern)(Code) | | converts a date object into a string representation using a cached simpledateformat
Parameters: callerClassName - the class of the object calling this method (used for caching) Parameters: d - the date to convert Parameters: locale - the locale to use in conversion Parameters: pattern - the date format to use |
getCurrentMonthAsString | final public static String getCurrentMonthAsString()(Code) | | Get a string representation of the month+year of current date.
For instance, if it's "15/07/2003", this method returns "072003".
|
getDateRangeList | final public static List getDateRangeList(Date start, Date end)(Code) | | get a list of date objects starting from 'start' and finishing -before- 'end'.
Note: start must be after end
Parameters: start - the date to start with Parameters: end - the date to end with |
getDaysBetween | final public static int getDaysBetween(Date d1, Date d2)(Code) | | |
getShortDay | final public static String getShortDay(int dayOfWeek)(Code) | | get a string representation of a day of week (eg. "Mon", "Tues", etc)
a string representation of the day |
getShortDay | final public static String getShortDay(Date date)(Code) | | get a string representation of the day of the week the specified date represents
Parameters: date - the date object to use |
getStartOfWeek | final public static Date getStartOfWeek(Date d)(Code) | | get the first day of the week based upon the specified date (looks backwards from the
date specified until it finds the monday)
|
isEqualUsingPattern | final public static boolean isEqualUsingPattern(String callerClassName, Date d1, Date d2, String pattern) throws ParseException(Code) | | returns true if two dates are equal using a particular date pattern
Parameters: callerClassName - the class of the object calling this method (used for caching) Parameters: d1 - the first date Parameters: d2 - the second date Parameters: pattern - the date format to compare the two date objects by |
isEqualUsingPattern | final public static boolean isEqualUsingPattern(String callerClassName, Date d1, Date d2, Locale locale, String pattern) throws ParseException(Code) | | returns true if two dates are equal using a particular date pattern
Parameters: callerClassName - the class of the object calling this method (used for caching) Parameters: d1 - the first date Parameters: d2 - the second date Parameters: locale - the locale to use when comparing the dates Parameters: pattern - the date format to compare the two date objects by |
parseDate | final public static Date parseDate(String callerClassName, String s, String pattern) throws ParseException(Code) | | turns a string representation of a date into a date object using a cached format
Parameters: callerClassName - the class of the object calling this method (used for caching) Parameters: s - the string date to convert Parameters: pattern - the date format to use |
parseDate | final public static Date parseDate(String callerClassName, String s, Locale locale, String pattern) throws ParseException(Code) | | turns a string representation of a date into a date object using a cached format
Parameters: callerClassName - the class of the object calling this method (used for caching) Parameters: s - the string date to convert Parameters: locale - the locale to use in conversion Parameters: pattern - the date format to use |
setTime | final public static Date setTime(String callerClassName, Date d, String time, String timeformat) throws ParseException(Code) | | takes a date object and sets a time value against it
Parameters: callerClassName - the class of the object calling this method (used for caching) Parameters: d - the date object to use Parameters: time - the string representation of the time to set on the date object Parameters: timeformat - the format of the time |
|
|