Package bank

Class Calendar

java.lang.Object
bank.Calendar

public class Calendar extends Object
Calendar class for keeping the current date and compute date intervals. Dates are represented as the number of days from 1970/01/01.
  • Method Details

    • getCalendar

      public static Calendar getCalendar()
      Returns:
      the single instance of this class.
    • today

      public long today()
      Returns:
      number of days since 1979/01/01.
    • daysSince

      public int daysSince(long before)
      Parameters:
      before - a previous date
      Returns:
      number of days from "before" to the today.
    • getDate

      public String getDate(long date)
      Parameters:
      date - number of days from 1970/01/01.
      Returns:
      string representing a date with the format AAAA MM DD.
    • setDate

      public void setDate(long date)
      Set today's date (for debug purposes only).
      Parameters:
      date - number of days from 1970/01/01.
    • advanceDate

      public void advanceDate(int days)
      Advance today's date by a given number of days.
      Parameters:
      days -
    • setDate

      public void setDate(int year, int month, int day)
      Set today's date (for debug purposes only).
      Parameters:
      year - today's year.
      month - today's month (starts at 1).
      day - today's day.
    • toString

      public final String toString()
      Overrides:
      toString in class Object
      See Also:
      Object.toString()