org.eclipse.birt.core.script
Class DateTimeSpan

java.lang.Object
  extended by org.eclipse.birt.core.script.DateTimeSpan

public class DateTimeSpan
extends java.lang.Object

Provides a set of functions for working with the difference between two dates.


Field Summary
protected static java.util.logging.Logger logger
          logger used to log syntax errors.
 
Method Summary
static java.util.Date addDate(java.util.Date startDate, int years, int months, int days)
           
static java.util.Date addTime(java.util.Date startDate, int hours, int minutes, int seconds)
           
static int days(java.util.Date startDate, java.util.Date endDate)
           
static int hours(java.util.Date startDate, java.util.Date endDate)
           
static int minutes(java.util.Date startDate, java.util.Date endDate)
           
static int months(java.util.Date startDate, java.util.Date endDate)
           
static int seconds(java.util.Date startDate, java.util.Date endDate)
           
static java.util.Date subDate(java.util.Date startDate, int years, int months, int days)
           
static java.util.Date subTime(java.util.Date startDate, int hours, int minutes, int seconds)
           
static int years(java.util.Date startDate, java.util.Date endDate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static java.util.logging.Logger logger
logger used to log syntax errors.

Method Detail

years

public static int years(java.util.Date startDate,
                        java.util.Date endDate)
Parameters:
startDate - A date object that represents the start of the span
endDate - A date object that represents the end of the span
Returns:
the number of years between two dates

months

public static int months(java.util.Date startDate,
                         java.util.Date endDate)
Parameters:
startDate - A date object that represents the start of the span
endDate - A date object that represents the end of the span
Returns:
the number of months between two dates

days

public static int days(java.util.Date startDate,
                       java.util.Date endDate)
Parameters:
startDate - A date object that represents the start of the span
endDate - A date object that represents the end of the span
Returns:
the number of days between two dates

hours

public static int hours(java.util.Date startDate,
                        java.util.Date endDate)
Parameters:
startDate - A date object that represents the start of the span
endDate - A date object that represents the end of the span
Returns:
the number of hours between two dates

minutes

public static int minutes(java.util.Date startDate,
                          java.util.Date endDate)
Parameters:
startDate - A date object that represents the start of the span
endDate - A date object that represents the end of the span
Returns:
the number of minutes between two dates

seconds

public static int seconds(java.util.Date startDate,
                          java.util.Date endDate)
Parameters:
startDate - A date object that represents the start of the span
endDate - A date object that represents the end of the span
Returns:
the number of seconds between two dates

addDate

public static java.util.Date addDate(java.util.Date startDate,
                                     int years,
                                     int months,
                                     int days)
Parameters:
startDate - A date object that represent the bass date.
years - The number of years to add to the date.
months - The number of month to add to the date.
days - The number of days to add to the date.
Returns:
A date that results from adding the years, months, and days to the start date.

addTime

public static java.util.Date addTime(java.util.Date startDate,
                                     int hours,
                                     int minutes,
                                     int seconds)
Parameters:
startDate - A date object that represents the base date
hours - The number of hours to add to the date
minutes - The number of minutes to add to the date
seconds - The number of seconds to add to the date
Returns:
A date that results adding the hours, minutes, seconds to the start date.

subDate

public static java.util.Date subDate(java.util.Date startDate,
                                     int years,
                                     int months,
                                     int days)
Parameters:
startDate - A date object that represent the bass date.
years - The number of years to add to the date.
months - The number of month to add to the date.
days - The number of days to add to the date.
Returns:
A date that results from subtract the years, months, and days from the start date.

subTime

public static java.util.Date subTime(java.util.Date startDate,
                                     int hours,
                                     int minutes,
                                     int seconds)
Parameters:
startDate - A date object that represents the base date
hours - The number of hours to add to the date
minutes - The number of minutes to add to the date
seconds - The number of seconds to add to the date
Returns:
A date that results subtracting the hours, minutes, seconds from the start date.


Copyright © 2008 Actuate Corp. All rights reserved.