com.mizar.commons.lang
Class DateUtils

java.lang.Object
  extended by org.apache.commons.lang.time.DateUtils
      extended by com.mizar.commons.lang.DateUtils

public class DateUtils
extends org.apache.commons.lang.time.DateUtils

Author Mark Millman


Field Summary
static long MILLIS_PER_WEEK
           
 
Fields inherited from class org.apache.commons.lang.time.DateUtils
MILLIS_IN_DAY, MILLIS_IN_HOUR, MILLIS_IN_MINUTE, MILLIS_IN_SECOND, MILLIS_PER_DAY, MILLIS_PER_HOUR, MILLIS_PER_MINUTE, MILLIS_PER_SECOND, RANGE_MONTH_MONDAY, RANGE_MONTH_SUNDAY, RANGE_WEEK_CENTER, RANGE_WEEK_MONDAY, RANGE_WEEK_RELATIVE, RANGE_WEEK_SUNDAY, SEMI_MONTH, UTC_TIME_ZONE
 
Constructor Summary
protected DateUtils()
           
 
Method Summary
static java.util.Date addDays(java.util.Date referenceDate, int days)
           
static java.util.Date beginningOfDay(java.util.Date date)
           
static java.util.Date beginningOfPreviousMonth(java.util.Date referenceDate)
           
static java.util.Date beginningOfTheMonth(java.util.Date referenceDate)
           
static java.util.Date beginningOfTheWeek(java.util.Date referenceDate)
           
static java.util.Date beginningOfTheYear(java.util.Date referenceDate)
           
static boolean between(java.util.Date referenceDate, java.util.Date fromDate, java.util.Date toDate)
           
static java.util.Date daysBefore(java.util.Date referenceDate, int days)
           
static long daysBetween(java.util.Date beginDate, java.util.Date endDate)
           
static java.util.Date endOfDay(java.util.Date date)
           
static java.util.Date endOfTheMonth(java.util.Date referenceDate)
           
static java.util.Date endOfTheWeek(java.util.Date referenceDate)
           
static java.lang.String formattedDate(java.util.Date date, java.lang.String format)
           
static java.util.Date fromISO(java.lang.String isoDate)
          DOES NOT ALLOW FOR PUNCTION : NEEDS MORE WORK
static java.lang.String getBuckeyeDate(java.util.Date date)
           
static long hoursBetween(java.util.Date beginDate, java.util.Date endDate)
           
static void main(java.lang.String[] args)
           
static java.util.Date midnightThisMorning()
           
static java.util.Date midnightTonight()
           
static long monthsBetween(java.util.Date beginDate, java.util.Date endDate)
           
static java.util.Date noon()
           
static java.util.Date now()
          This method just returns new Date()
static java.lang.String now(java.lang.String format)
           
static java.util.Date oneDayAfter(java.util.Date referenceDate)
           
static java.util.Date oneDayBefore(java.util.Date referenceDate)
           
static java.util.Date oneMonthAfter(java.util.Date referenceDate)
           
static java.util.Date oneMonthBefore(java.util.Date referenceDate)
           
static java.util.Date oneWeekAfter(java.util.Date referenceDate)
           
static java.util.Date oneWeekBefore(java.util.Date referenceDate)
           
static java.util.Date sixMonthsBefore(java.util.Date referenceDate)
           
static java.util.Date tomorrowNoon()
           
static long weeksBetween(java.util.Date beginDate, java.util.Date endDate)
           
 
Methods inherited from class org.apache.commons.lang.time.DateUtils
add, addHours, addMilliseconds, addMinutes, addMonths, addSeconds, addWeeks, addYears, ceiling, ceiling, ceiling, getFragmentInDays, getFragmentInDays, getFragmentInHours, getFragmentInHours, getFragmentInMilliseconds, getFragmentInMilliseconds, getFragmentInMinutes, getFragmentInMinutes, getFragmentInSeconds, getFragmentInSeconds, isSameDay, isSameDay, isSameInstant, isSameInstant, isSameLocalTime, iterator, iterator, iterator, parseDate, parseDateStrictly, round, round, round, setDays, setHours, setMilliseconds, setMinutes, setMonths, setSeconds, setYears, toCalendar, truncate, truncate, truncate, truncatedCompareTo, truncatedCompareTo, truncatedEquals, truncatedEquals
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MILLIS_PER_WEEK

public static final long MILLIS_PER_WEEK
See Also:
Constant Field Values
Constructor Detail

DateUtils

protected DateUtils()
Method Detail

addDays

public static java.util.Date addDays(java.util.Date referenceDate,
                                     int days)
Parameters:
referenceDate -
days -
Returns:
date in future
See Also:
DateUtils.addDays(Date,int)

between

public static boolean between(java.util.Date referenceDate,
                              java.util.Date fromDate,
                              java.util.Date toDate)

fromISO

public static java.util.Date fromISO(java.lang.String isoDate)
DOES NOT ALLOW FOR PUNCTION : NEEDS MORE WORK

Parameters:
isoDate - (YYYY or YYYYMM or YYYYMMDD only)
Returns:

now

public static java.util.Date now()
This method just returns new Date()

Returns:
the current date and time

now

public static java.lang.String now(java.lang.String format)
Parameters:
format - a SimpleDateFormat
Returns:
See Also:
SimpleDateFormat(String)

formattedDate

public static java.lang.String formattedDate(java.util.Date date,
                                             java.lang.String format)
Parameters:
date - a date
format - a SimpleDateFormat
Returns:
See Also:
SimpleDateFormat(String)

tomorrowNoon

public static java.util.Date tomorrowNoon()
Returns:
the time and date of yesterday at noon

noon

public static java.util.Date noon()
Returns:
the time and date of noon today

endOfDay

public static java.util.Date endOfDay(java.util.Date date)
Parameters:
date -
Returns:
one millisecond before midnight of date

midnightTonight

public static java.util.Date midnightTonight()
Returns:
one millisecond before midnight tonight

beginningOfDay

public static java.util.Date beginningOfDay(java.util.Date date)
Parameters:
date -
Returns:
Zero hours of date

midnightThisMorning

public static java.util.Date midnightThisMorning()
Returns:
midnight this morning

beginningOfTheWeek

public static java.util.Date beginningOfTheWeek(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
a Date associated with midnight of the morning of the first day of the week of referenceDate.
See Also:
Calendar.getFirstDayOfWeek()

endOfTheWeek

public static java.util.Date endOfTheWeek(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
a Date associated with one millisecond before midnight of the last day of the week of referenceDate.
See Also:
Calendar.getFirstDayOfWeek()

beginningOfTheMonth

public static java.util.Date beginningOfTheMonth(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
a Date associated with midnight of the morning of the first day of the month of referenceDate

beginningOfPreviousMonth

public static java.util.Date beginningOfPreviousMonth(java.util.Date referenceDate)

beginningOfTheYear

public static java.util.Date beginningOfTheYear(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
a Date associated with midnight of the morning of the first day of the year of referenceDate

endOfTheMonth

public static java.util.Date endOfTheMonth(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
a Date associated with one millisecond before midnight of the last day of the month of referenceDate

daysBefore

public static java.util.Date daysBefore(java.util.Date referenceDate,
                                        int days)
Parameters:
referenceDate - - defaults to now if null
days - 24 hour days prior to referenceDate
Returns:

oneDayBefore

public static java.util.Date oneDayBefore(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
24 hours prior to referenceDate

oneDayAfter

public static java.util.Date oneDayAfter(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
24 hours after referenceDate

oneWeekBefore

public static java.util.Date oneWeekBefore(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
7 days prior to referenceDate

oneWeekAfter

public static java.util.Date oneWeekAfter(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
7 days after referenceDate

oneMonthBefore

public static java.util.Date oneMonthBefore(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
one month before the reference date
See Also:
Calendar.setTime(Date)

sixMonthsBefore

public static java.util.Date sixMonthsBefore(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
six months before the reference date
See Also:
Calendar.setTime(Date)

oneMonthAfter

public static java.util.Date oneMonthAfter(java.util.Date referenceDate)
Parameters:
referenceDate - - defaults to now if null
Returns:
one month after the reference date
See Also:
Calendar.setTime(Date)

hoursBetween

public static long hoursBetween(java.util.Date beginDate,
                                java.util.Date endDate)
Parameters:
beginDate -
endDate -
Returns:
the hours between beginDate and endDate

daysBetween

public static long daysBetween(java.util.Date beginDate,
                               java.util.Date endDate)
Parameters:
beginDate -
endDate -
Returns:
the days between beginDate and endDate

weeksBetween

public static long weeksBetween(java.util.Date beginDate,
                                java.util.Date endDate)
Parameters:
beginDate -
endDate -
Returns:
the weeks between beginDate and endDate

monthsBetween

public static long monthsBetween(java.util.Date beginDate,
                                 java.util.Date endDate)
Parameters:
beginDate -
endDate -
Returns:
the months between beginDate and endDate

main

public static void main(java.lang.String[] args)

getBuckeyeDate

public static java.lang.String getBuckeyeDate(java.util.Date date)