Package gnu.math

Class DateTime

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class DateTime
    extends Quantity
    implements java.lang.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:
    Serialized Form
    • Constructor Detail

      • DateTime

        public DateTime​(int mask)
      • DateTime

        public DateTime​(int mask,
                        java.util.GregorianCalendar calendar)
    • Method Detail

      • components

        public int components()
      • cast

        public DateTime cast​(int newComponents)
      • parse

        public static DateTime parse​(java.lang.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​(java.lang.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
      • withZoneUnspecified

        public DateTime withZoneUnspecified()
      • adjustTimezone

        public DateTime adjustTimezone​(int newOffset)
      • add

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

        public void toStringDate​(java.lang.StringBuffer sbuf)
      • toStringTime

        public void toStringTime​(java.lang.StringBuffer sbuf)
      • isZoneUnspecified

        public boolean isZoneUnspecified()
      • getZoneMinutes

        public int getZoneMinutes()
      • minutesToTimeZone

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

        public void setTimeZone​(java.util.TimeZone timeZone)
      • toStringZone

        public void toStringZone​(java.lang.StringBuffer sbuf)
      • toStringZone

        public static void toStringZone​(int minutes,
                                        java.lang.StringBuffer sbuf)
      • toString

        public void toString​(java.lang.StringBuffer sbuf)
      • toString

        public java.lang.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