Package gnu.math

Class DateTime

All Implemented Interfaces:
Serializable, Cloneable

public class DateTime extends Quantity implements Cloneable
Represents a date and/or time. Similar functionality as java.util.Calendar (and uses GregorianCalendar internally) but supports arithmetic. Can be for XML Schema date/time types, specifically as used in XPath/Xquery..
See Also:
  • Field Details

  • Constructor Details

    • DateTime

      public DateTime(int mask)
    • DateTime

      public DateTime(int mask, GregorianCalendar calendar)
  • Method Details

    • components

      public int components()
    • cast

      public DateTime cast(int newComponents)
    • parse

      public static DateTime parse(String value, int mask)
    • isLeapYear

      public static boolean isLeapYear(int year)
    • daysInMonth

      public static int daysInMonth(int month, int year)
    • getYear

      public int getYear()
    • getMonth

      public int getMonth()
    • getDay

      public int getDay()
    • getHours

      public int getHours()
    • getMinutes

      public int getMinutes()
    • getSecondsOnly

      public int getSecondsOnly()
    • getWholeSeconds

      public int getWholeSeconds()
    • getNanoSecondsOnly

      public int getNanoSecondsOnly()
    • compare

      public static int compare(DateTime date1, DateTime date2)
      Return -1, 0, or 1, depending on which value is greater.
    • compare

      public int compare(Object obj)
      Description copied from class: Numeric
      Return an integer for which of this or obj is larger. Return 1 if this>obj; 0 if this==obj; -1 if this<obj; -2 if this!=obj otherwise (for example if either is NaN); -3 if not comparable (incompatible types).
      Overrides:
      compare in class Quantity
    • sub

      public static Duration sub(DateTime date1, DateTime date2)
    • withZoneUnspecified

      public DateTime withZoneUnspecified()
    • adjustTimezone

      public DateTime adjustTimezone(int newOffset)
    • add

      public static DateTime add(DateTime x, Duration y, int k)
    • addMinutes

      public static DateTime addMinutes(DateTime x, int y)
    • addSeconds

      public static DateTime addSeconds(DateTime x, int y)
    • add

      public Numeric add(Object y, int k)
      Description copied from class: Numeric
      Return this + k * obj.
      Overrides:
      add in class Quantity
    • addReversed

      public Numeric addReversed(Numeric x, int k)
      Description copied from class: Numeric
      Calculate x+k&this.
      Overrides:
      addReversed in class Quantity
    • toStringDate

      public void toStringDate(StringBuffer sbuf)
    • toStringTime

      public void toStringTime(StringBuffer sbuf)
    • isZoneUnspecified

      public boolean isZoneUnspecified()
    • getZoneMinutes

      public int getZoneMinutes()
    • minutesToTimeZone

      public static TimeZone minutesToTimeZone(int minutes)
      Get a TimeZone object for a given offset.
      Parameters:
      minutes - timezone offset in minutes.
    • setTimeZone

      public void setTimeZone(TimeZone timeZone)
    • toStringZone

      public void toStringZone(StringBuffer sbuf)
    • toStringZone

      public static void toStringZone(int minutes, StringBuffer sbuf)
    • toString

      public void toString(StringBuffer sbuf)
    • toString

      public String toString()
      Overrides:
      toString in class Numeric
    • isExact

      public boolean isExact()
      Specified by:
      isExact in class Numeric
    • isZero

      public boolean isZero()
      Specified by:
      isZero in class Numeric
    • unit

      public Unit unit()
      Overrides:
      unit in class Quantity
    • number

      public Complex number()
      Specified by:
      number in class Quantity