All Packages Class Hierarchy This Package Previous Next Index
Class JBMSTours.JCalendar
java.lang.Object
|
+----JBMSTours.JCalendar
- public class JCalendar
- extends Object
Look at the Source.
This class creates an array of 64 dates beginning with TODAY.
Used by BuildATour to come up with dates in the next 64 days and so build a
database with current data.
The static methods of this class make it easier to work with java.sql.Dates.
For example, some of the methods allow you to add and
subtract dates and times, since that's not built into
the Java core classes.
-
NUMDAYS
-
-
JCalendar()
-
-
getDate(Date)
-
Returns the day of the month for the given date.
-
getDateDifference(Date, Date)
- Get the difference between two java.sql.Dates using their UTC values.
-
getDay(int)
- Get a particular day.
-
getMonth(Date)
-
Returns the month
-
getTheTimeDifference(Time, Time)
-
Returns the difference between two times as a Time.
-
getTimeDifference(Time, Time)
-
Returns the difference between two times as a double.
-
getToday()
-
Returns java.sql.Date representing the current date or a testing
date (if one has been set).
-
getYear(Date)
-
Returns the actual year for the given date (NOT year-1900).
-
incrementDate(Date)
- Increment the given date by one day.
NUMDAYS
public static int NUMDAYS
JCalendar
public JCalendar()
getDay
public Date getDay(int i)
- Get a particular day.
- Parameters:
- i - the date
- Returns:
- the day
incrementDate
public static Date incrementDate(Date theDate)
- Increment the given date by one day.
- Parameters:
- theDate - the date to increment
- Returns:
- the new date (theDate + 1 day)
getDateDifference
public static int getDateDifference(Date later,
Date earlier)
- Get the difference between two java.sql.Dates using their UTC values.
If the second date is later than the first date, returns a negative number.
- Parameters:
- later - the first date
- earlier - the second date
- Returns:
- int
getTheTimeDifference
public static Time getTheTimeDifference(Time start,
Time end)
- Returns the difference between two times as a Time. If end is
before beginning, assumes only one rotation of clock.
- Parameters:
- start - the start time
- end - the end time
- Returns:
- the difference as a java.sql.Time
getTimeDifference
public static double getTimeDifference(Time start,
Time end)
- Returns the difference between two times as a double. If end is
before beginning, assumes only one rotation of clock.
- Parameters:
- start - the start time
- end - the end time
- Returns:
- the difference as a double
getToday
public static Date getToday()
- Returns java.sql.Date representing the current date or a testing
date (if one has been set).
- Returns:
- today
If there is a system property called JBMSTours.testDate, we
are in test mode, and that property is a String that represents
the value of "now". This allows us to get consistent results
while testing this application. If this property is not set,
the results depend on today's date.
The value of the property is specified as the number of milliseconds
since January 1, 1970, 00:00:00 GMT.
getDate
public static int getDate(Date d)
- Returns the day of the month for the given date.
- Parameters:
- d - The given date.
- Returns:
- today
getYear
public static int getYear(Date d)
- Returns the actual year for the given date (NOT year-1900).
- Parameters:
- d - The given date.
- Returns:
- today
getMonth
public static int getMonth(Date d)
- Returns the month
- Parameters:
- d - The given date.
- Returns:
- today
All Packages Class Hierarchy This Package Previous Next Index