02/28/2005
 

com.epicentric.common
Class DateUtils

java.lang.Object
  |
  +--com.epicentric.common.DateUtils

Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with class DateUtils.

public class DateUtils
extends Object

Utilities for date manipulation, comparison and arithmetic.


Field Summary
static int APRIL
          Deprecated.  
static int AUGUST
          Deprecated.  
static int CENTURIES
          Deprecated.  
static int DAYS
          Deprecated.  
static int DECEMBER
          Deprecated.  
static int FEBRUARY
          Deprecated.  
static int FIRST_BUSINESS_DAY
          Deprecated.  
static int FRIDAY
          Deprecated.  
static int HOURS
          Deprecated.  
static int JANUARY
          Deprecated.  
static int JULY
          Deprecated.  
static int JUNE
          Deprecated.  
static int LAST_BUSINESS_DAY
          Deprecated.  
static int LAST_DAY
          Deprecated.  
static int MARCH
          Deprecated.  
static int MAY
          Deprecated.  
static int MILLISECONDS
          Deprecated.  
static int MINUTES
          Deprecated.  
static int MONDAY
          Deprecated.  
static int MONTHS
          Deprecated.  
static int NOVEMBER
          Deprecated.  
static int OCTOBER
          Deprecated.  
static int SATURDAY
          Deprecated.  
static int SECONDS
          Deprecated.  
static int SEPTEMBER
          Deprecated.  
static int SUNDAY
          Deprecated.  
static int THURSDAY
          Deprecated.  
static int TUESDAY
          Deprecated.  
static int WEDNESDAY
          Deprecated.  
static int WEEKS
          Deprecated.  
static int YEARS
          Deprecated.  
 
Constructor Summary
DateUtils()
          Deprecated.  
 
Method Summary
static Date addInterval(Date date, int interval, int intervalUnits)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use java.util.Calendar).
static int compareTime(Date date1, Date date2)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static String dateTommddyy(Date date)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement. (use DateFormat).
static String DateToNumericString(Date date)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static boolean dayOfMonthMatch(Date date, int dayOfMonth)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static int diffInDays(Date d1, Date d2)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replace with DateUtils.diffInDays(Date,Date).
static long diffInSecs(Date d1, Date d2)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replace with DateUtils.diffInSecs(Date,Date).
static boolean equalsIgnoreTime(Date date1, Date date2)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with DateUtils.equalsIgnoreTime(Date,Date).
static String getDateTimeStamp(Date date)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replace with DateUtils.getISODateStamp(Date) or DateUtils.getISODateTimeStamp(Date).
static Calendar getNewCalendar()
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static Calendar getNewCalendar(Date date)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use one of the Calendar.getInstance() methods.
static Calendar getNewCalendar(long milliseconds)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use Calendar.setTimeInMillis(long)).
static int[] incrementMonthYear(int year, int month, int months)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use java.util.Calendar).
static boolean inDateRange(Date date, int startMonth, int startDay, int endMonth, int endDay)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static boolean isLastDayOfMonth(Date date)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static boolean isSameDay(Date date1, Date date2)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with DateUtils.equalsIgnoreTime(Date,Date).
static boolean isToday(Date then)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replace with DateUtils.isToday(Date)
static Date mmddyyToBirthDate(String dateStr)
          Deprecated. As of version 3.5. Will be removed in 8.0 or later. Use mmddyyToDate instead.
static Date mmddyyToDate(String dateStr)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement. (use .
static long msecInPeriod(int intervalUnits)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static Date now()
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use new Date()).
static Date NumericStringToDate(String string)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static void validateIntervalUnits(int intervalUnits)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MILLISECONDS

public static final int MILLISECONDS
Deprecated. 

SECONDS

public static final int SECONDS
Deprecated. 

MINUTES

public static final int MINUTES
Deprecated. 

HOURS

public static final int HOURS
Deprecated. 

DAYS

public static final int DAYS
Deprecated. 

WEEKS

public static final int WEEKS
Deprecated. 

MONTHS

public static final int MONTHS
Deprecated. 

YEARS

public static final int YEARS
Deprecated. 

CENTURIES

public static final int CENTURIES
Deprecated. 

SUNDAY

public static final int SUNDAY
Deprecated. 

MONDAY

public static final int MONDAY
Deprecated. 

TUESDAY

public static final int TUESDAY
Deprecated. 

WEDNESDAY

public static final int WEDNESDAY
Deprecated. 

THURSDAY

public static final int THURSDAY
Deprecated. 

FRIDAY

public static final int FRIDAY
Deprecated. 

SATURDAY

public static final int SATURDAY
Deprecated. 

LAST_DAY

public static final int LAST_DAY
Deprecated. 

FIRST_BUSINESS_DAY

public static final int FIRST_BUSINESS_DAY
Deprecated. 

LAST_BUSINESS_DAY

public static final int LAST_BUSINESS_DAY
Deprecated. 

JANUARY

public static final int JANUARY
Deprecated. 

FEBRUARY

public static final int FEBRUARY
Deprecated. 

MARCH

public static final int MARCH
Deprecated. 

APRIL

public static final int APRIL
Deprecated. 

MAY

public static final int MAY
Deprecated. 

JUNE

public static final int JUNE
Deprecated. 

JULY

public static final int JULY
Deprecated. 

AUGUST

public static final int AUGUST
Deprecated. 

SEPTEMBER

public static final int SEPTEMBER
Deprecated. 

OCTOBER

public static final int OCTOBER
Deprecated. 

NOVEMBER

public static final int NOVEMBER
Deprecated. 

DECEMBER

public static final int DECEMBER
Deprecated. 
Constructor Detail

DateUtils

public DateUtils()
Deprecated. 
Method Detail

msecInPeriod

public static long msecInPeriod(int intervalUnits)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Return the number of milliseconds in unit.

addInterval

public static Date addInterval(Date date,
                               int interval,
                               int intervalUnits)
                        throws IllegalArgumentException
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use java.util.Calendar).

Add an interval of units specified to date.
Parameters:
date - to increment
interval - amount to increment
intervalUnits - one of the interval unit constants in this class
Returns:
new date

incrementMonthYear

public static int[] incrementMonthYear(int year,
                                       int month,
                                       int months)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use java.util.Calendar).

Given year, month and #-months to increment, return the new year and month.
Parameters:
year -  
month -  
months -  
Returns:
int[] [0]=month, [1]=year after months added in.

validateIntervalUnits

public static void validateIntervalUnits(int intervalUnits)
                                  throws IllegalArgumentException
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Any class that stores intervalUnits can call this method to make sure it has a valid intervalUnits value: that is, one that can be used by DateUtils.
Parameters:
intervalUnits - integer matching units constants available in this class.

dayOfMonthMatch

public static boolean dayOfMonthMatch(Date date,
                                      int dayOfMonth)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Return whether date is a match on dayOfMonth. Support special value LAST_DAY

isLastDayOfMonth

public static boolean isLastDayOfMonth(Date date)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Return whether this date is the last day of its month. Is aware of leap year.

now

public static Date now()
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use new Date()).

Return current date/time.

equalsIgnoreTime

public static boolean equalsIgnoreTime(Date date1,
                                       Date date2)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with DateUtils.equalsIgnoreTime(Date,Date).

Test whether date1 and date2 are the same date.

compareTime

public static int compareTime(Date date1,
                              Date date2)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Compare the times. Compares hours, mins, secs, but not milliseconds.
Returns:
0 if equal, 1 if date1 > date2, -1 if date1 < date2

isToday

public static boolean isToday(Date then)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replace with DateUtils.isToday(Date)


diffInDays

public static int diffInDays(Date d1,
                             Date d2)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replace with DateUtils.diffInDays(Date,Date).


diffInSecs

public static long diffInSecs(Date d1,
                              Date d2)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replace with DateUtils.diffInSecs(Date,Date).

Return the number of seconds difference between the two dates.

getDateTimeStamp

public static String getDateTimeStamp(Date date)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replace with DateUtils.getISODateStamp(Date) or DateUtils.getISODateTimeStamp(Date).

Return datetimestamp, as yyyyMMdd_HHmmssSSS

mmddyyToBirthDate

public static Date mmddyyToBirthDate(String dateStr)
Deprecated. As of version 3.5. Will be removed in 8.0 or later. Use mmddyyToDate instead.

Parameters:
dateStr - is date of birth in "MM/DD/YY" format (doesn't require leading zeros). see Sun's api documentation for the following classes for details on parsing boundary conditions: java.util.Date java.text.DateFormat java.text.SimpleDateFormat

mmddyyToDate

public static Date mmddyyToDate(String dateStr)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement. (use .

Parameters:
dateStr - is date in "MM/DD/YY" format (doesn't require leading zeros). see Sun's api documentation for the following classes for details on parsing boundary conditions: java.util.Date java.text.DateFormat java.text.SimpleDateFormat

dateTommddyy

public static String dateTommddyy(Date date)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement. (use DateFormat).

Converts Date object into string with the format "MM/DD/YY" (adds leading zeros).

inDateRange

public static boolean inDateRange(Date date,
                                  int startMonth,
                                  int startDay,
                                  int endMonth,
                                  int endDay)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

assumes the dates are in a single year.
Returns:
true if the given date's month & day are within the given range end points (inclusive).

getNewCalendar

public static Calendar getNewCalendar(Date date)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use one of the Calendar.getInstance() methods.

Method for getting a new calendar from a date

getNewCalendar

public static Calendar getNewCalendar(long milliseconds)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement (use Calendar.setTimeInMillis(long)).

Method for getting a new calendar from milliseconds

getNewCalendar

public static Calendar getNewCalendar()
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Method for getting a new calendar.

DateToNumericString

public static String DateToNumericString(Date date)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Gets the millisecond representation of the date object and returns it as a string or null if the date object was null.

NumericStringToDate

public static Date NumericStringToDate(String string)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Accepts a string containing the millisecond representation of a Date object, parses the numeric value from the string and contructs a new Date object based on the value. returns the parsed Date if successful, or null if there were parsing errors.

isSameDay

public static boolean isSameDay(Date date1,
                                Date date2)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with DateUtils.equalsIgnoreTime(Date,Date).

Compares two Date instances to see if they refer to the same day
Parameters:
date1 - the Date to compare with date2
date2 - the Date to compare with date1
Returns:
true if all of the following holds:
  • date1 != null && date2 != null
  • date1.getDate() == date2.getDate()
  • date1.getMonth() == date2.getMonth()
  • date1.getYear() == date2.getYear()
or false is any of the above conditions are not true
Since:
4.0

02/28/2005
 

Copyright and Trademark Notices