com.diasparsoftware.java.util
Class DateUtil

java.lang.Object
  extended bycom.diasparsoftware.java.util.DateUtil

public class DateUtil
extends java.lang.Object


Constructor Summary
DateUtil()
           
 
Method Summary
static int computeAge(java.util.Date dateOfBirth, java.util.Date futureDate)
          Compute someone's age from their date of birth and a future date.
static int getMonth(java.util.Date date)
           
static int getYear(java.util.Date date)
           
static java.util.Date makeDate(int year, int month, int day)
          Create a Date object from the parameters you expect to pass -- none of this "year minus 1900" and "months start from 0" nonsense and we assume Gregorian!
static java.util.Date makeDate(int year, int month, int day, int hour, int minute, int second)
           
static java.util.Date makeFutureDate(java.util.Date date, int daysLater)
          Make a date a specified number of days in the future from the provided date.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateUtil

public DateUtil()
Method Detail

makeDate

public static java.util.Date makeDate(int year,
                                      int month,
                                      int day)
Create a Date object from the parameters you expect to pass -- none of this "year minus 1900" and "months start from 0" nonsense and we assume Gregorian!

Parameters:
year - The real year: do not subtract 1900
month - The real month: do not subtract 1
day - Yes, we call it "day" and not "date"
Returns:

makeDate

public static java.util.Date makeDate(int year,
                                      int month,
                                      int day,
                                      int hour,
                                      int minute,
                                      int second)

getMonth

public static int getMonth(java.util.Date date)

getYear

public static int getYear(java.util.Date date)

makeFutureDate

public static java.util.Date makeFutureDate(java.util.Date date,
                                            int daysLater)
Make a date a specified number of days in the future from the provided date.

Parameters:
date - A benchmark date.
daysLater - The number of days after the benchmark date you want to go.
Returns:

computeAge

public static int computeAge(java.util.Date dateOfBirth,
                             java.util.Date futureDate)
Compute someone's age from their date of birth and a future date. If you give a future date not in the future, you will probably get a negative number.

Parameters:
dateOfBirth -
futureDate -
Returns:


Copyright © 2003-2004 Diaspar Software Services, Inc.. All Rights Reserved.