Class Quarter

java.lang.Object
org.deltava.beans.hr.Quarter
All Implemented Interfaces:
Serializable, Comparable<Quarter>

public class Quarter extends Object implements Serializable, Comparable<Quarter>
A bean to convert Dates into Quarters.
Since:
3.3
Version:
11.0
Author:
Luke
See Also:
  • Constructor Details

    • Quarter

      public Quarter()
      Creates a Quarter from the current Date.
    • Quarter

      public Quarter(Instant dt)
      Creates a new Quarter from a Date.
      Parameters:
      dt - the Date
      Throws:
      NullPointerException - if dt is null
    • Quarter

      public Quarter(int yq)
      Creates a new Quarter from a year/quarter combination
      Parameters:
      yq - the year quarter
      See Also:
  • Method Details

    • getYear

      public int getYear()
      Returns the year.
      Returns:
      the year
    • getQuarter

      public int getQuarter()
      Returns the quarter number.
      Returns:
      the quarter number
    • getYearQuarter

      public int getYearQuarter()
      Returns the year and quarter in the form of a five digit number as YYYYQ.
      Returns:
      the year and quarter
    • contains

      public boolean contains(Instant dt)
      Returns whether a date is in this Quarter.
      Parameters:
      dt - the date
      Returns:
      TRUE if in the Quarter, otherwise FALSE
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Quarter q2)
      Specified by:
      compareTo in interface Comparable<Quarter>