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:
    Serialized Form
    • Constructor Detail

      • DateTime

        public DateTime​(int mask)
    • Method Detail

      • components

        public int components()
      • cast

        public DateTime cast​(int newComponents)
      • 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
      • withZoneUnspecified

        public DateTime withZoneUnspecified()
      • adjustTimezone

        public DateTime adjustTimezone​(int newOffset)
      • 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)
      • isExact

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

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