Save This Page
Home » jcommon-1.0.13 » org.jfree.date » [javadoc | source]
org.jfree.date
public class: SpreadsheetDate [javadoc | source]
java.lang.Object
   org.jfree.date.SerialDate
      org.jfree.date.SpreadsheetDate

All Implemented Interfaces:
    Serializable, MonthConstants, Comparable

Represents a date using an integer, in a similar fashion to the implementation in Microsoft Excel. The range of dates supported is 1-Jan-1900 to 31-Dec-9999.

Be aware that there is a deliberate bug in Excel that recognises the year 1900 as a leap year when in fact it is not a leap year. You can find more information on the Microsoft website in article Q181370:

http://support.microsoft.com/support/kb/articles/Q181/3/70.asp

Excel uses the convention that 1-Jan-1900 = 1. This class uses the convention 1-Jan-1900 = 2. The result is that the day number in this class will be different to the Excel figure for January and February 1900...but then Excel adds in an extra day (29-Feb-1900 which does not actually exist!) and from that point forward the day numbers will match.

Fields inherited from org.jfree.date.SerialDate:
DATE_FORMAT_SYMBOLS,  SERIAL_LOWER_BOUND,  SERIAL_UPPER_BOUND,  MINIMUM_YEAR_SUPPORTED,  MAXIMUM_YEAR_SUPPORTED,  MONDAY,  TUESDAY,  WEDNESDAY,  THURSDAY,  FRIDAY,  SATURDAY,  SUNDAY,  LAST_DAY_OF_MONTH,  AGGREGATE_DAYS_TO_END_OF_MONTH,  AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH,  LEAP_YEAR_AGGREGATE_DAYS_TO_END_OF_MONTH,  LEAP_YEAR_AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH,  FIRST_WEEK_IN_MONTH,  SECOND_WEEK_IN_MONTH,  THIRD_WEEK_IN_MONTH,  FOURTH_WEEK_IN_MONTH,  LAST_WEEK_IN_MONTH,  INCLUDE_NONE,  INCLUDE_FIRST,  INCLUDE_SECOND,  INCLUDE_BOTH,  PRECEDING,  NEAREST,  FOLLOWING
Constructor:
 public SpreadsheetDate(int serial) 
 public SpreadsheetDate(int day,
    int month,
    int year) 
Method from org.jfree.date.SpreadsheetDate Summary:
compare,   compareTo,   equals,   getDayOfMonth,   getDayOfWeek,   getMonth,   getYYYY,   hashCode,   isAfter,   isBefore,   isInRange,   isInRange,   isOn,   isOnOrAfter,   isOnOrBefore,   toDate,   toSerial
Methods from org.jfree.date.SerialDate:
addDays,   addMonths,   addYears,   compare,   createInstance,   createInstance,   createInstance,   getDayOfMonth,   getDayOfWeek,   getDescription,   getEndOfCurrentMonth,   getFollowingDayOfWeek,   getFollowingDayOfWeek,   getMonth,   getMonths,   getMonths,   getNearestDayOfWeek,   getNearestDayOfWeek,   getPreviousDayOfWeek,   getPreviousDayOfWeek,   getYYYY,   isAfter,   isBefore,   isInRange,   isInRange,   isLeapYear,   isOn,   isOnOrAfter,   isOnOrBefore,   isValidMonthCode,   isValidWeekInMonthCode,   isValidWeekdayCode,   lastDayOfMonth,   leapYearCount,   monthCodeToQuarter,   monthCodeToString,   monthCodeToString,   relativeToString,   setDescription,   stringToMonthCode,   stringToWeekdayCode,   toDate,   toSerial,   toString,   weekInMonthToString,   weekdayCodeToString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jfree.date.SpreadsheetDate Detail:
 public int compare(SerialDate other) 
    Returns the difference (in days) between this date and the specified 'other' date.
 public int compareTo(Object other) 
    Implements the method required by the Comparable interface.
 public boolean equals(Object object) 
    Tests the equality of this date with an arbitrary object.

    This method will return true ONLY if the object is an instance of the SerialDate base class, and it represents the same day as this SpreadsheetDate .

 public int getDayOfMonth() 
    Returns the day of the month.
 public int getDayOfWeek() 
    Returns a code representing the day of the week.

    The codes are defined in the SerialDate class as: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY.

 public int getMonth() 
    Returns the month (January = 1, February = 2, March = 3).
 public int getYYYY() 
    Returns the year (assume a valid range of 1900 to 9999).
 public int hashCode() 
    Returns a hash code for this object instance.
 public boolean isAfter(SerialDate other) 
    Returns true if this SerialDate represents the same date as the specified SerialDate.
 public boolean isBefore(SerialDate other) 
    Returns true if this SerialDate represents an earlier date compared to the specified SerialDate.
 public boolean isInRange(SerialDate d1,
    SerialDate d2) 
    Returns true if this SerialDate is within the specified range (INCLUSIVE). The date order of d1 and d2 is not important.
 public boolean isInRange(SerialDate d1,
    SerialDate d2,
    int include) 
    Returns true if this SerialDate is within the specified range (caller specifies whether or not the end-points are included). The order of d1 and d2 is not important.
 public boolean isOn(SerialDate other) 
    Returns true if this SerialDate represents the same date as the specified SerialDate.
 public boolean isOnOrAfter(SerialDate other) 
    Returns true if this SerialDate represents the same date as the specified SerialDate.
 public boolean isOnOrBefore(SerialDate other) 
    Returns true if this SerialDate represents the same date as the specified SerialDate.
 public Date toDate() 
    Returns a java.util.Date equivalent to this date.
 public int toSerial() 
    Returns the serial number for the date, where 1 January 1900 = 2 (this corresponds, almost, to the numbering system used in Microsoft Excel for Windows and Lotus 1-2-3).