Package gnu.math
Class DateTime
java.lang.Object
java.lang.Number
gnu.math.Numeric
gnu.math.Quantity
gnu.math.DateTime
- All Implemented Interfaces:
Serializable
,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 Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static TimeZone
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DateTime
Return this + k * obj.static DateTime
addMinutes
(DateTime x, int y) addReversed
(Numeric x, int k) Calculatex+k&this
.static DateTime
addSeconds
(DateTime x, int y) adjustTimezone
(int newOffset) cast
(int newComponents) static int
Return -1, 0, or 1, depending on which value is greater.int
Return an integer for which ofthis
orobj
is larger.int
static int
daysInMonth
(int month, int year) int
getDay()
int
getHours()
int
int
getMonth()
int
int
int
int
getYear()
int
boolean
isExact()
static boolean
isLeapYear
(int year) boolean
isZero()
boolean
static TimeZone
minutesToTimeZone
(int minutes) Get a TimeZone object for a given offset.number()
static DateTime
void
setTimeZone
(TimeZone timeZone) static Duration
toString()
void
toString
(StringBuffer sbuf) void
toStringDate
(StringBuffer sbuf) void
toStringTime
(StringBuffer sbuf) static void
toStringZone
(int minutes, StringBuffer sbuf) void
toStringZone
(StringBuffer sbuf) unit()
Methods inherited from class gnu.math.Quantity
abs, add, compare, compareReversed, dimensions, div, divide, divReversed, doubleImagValue, doubleJmagValue, doubleKmagValue, doubleValue, im, imValue, jm, jmValue, km, kmValue, make, make, make, mul, mulReversed, neg, re, reValue, times, toString
Methods inherited from class gnu.math.Numeric
add, asNumericOrNull, div_inv, equals, floatValue, geq, grt, intValue, longValue, mul_ident, power, sub, toExact, toInexact
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
YEAR_MASK
public static final int YEAR_MASK- See Also:
-
MONTH_MASK
public static final int MONTH_MASK- See Also:
-
DAY_MASK
public static final int DAY_MASK- See Also:
-
HOURS_MASK
public static final int HOURS_MASK- See Also:
-
MINUTES_MASK
public static final int MINUTES_MASK- See Also:
-
SECONDS_MASK
public static final int SECONDS_MASK- See Also:
-
TIMEZONE_MASK
public static final int TIMEZONE_MASK- See Also:
-
DATE_MASK
public static final int DATE_MASK- See Also:
-
TIME_MASK
public static final int TIME_MASK- See Also:
-
GMT
-
-
Constructor Details
-
DateTime
public DateTime(int mask) -
DateTime
-
-
Method Details
-
components
public int components() -
cast
-
parse
-
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
Return -1, 0, or 1, depending on which value is greater. -
compare
Description copied from class:Numeric
Return an integer for which ofthis
orobj
is larger. Return 1 ifthis>obj
; 0 ifthis==obj
; -1 ifthis<obj
; -2 ifthis!=obj
otherwise (for example if either is NaN); -3 if not comparable (incompatible types). -
sub
-
withZoneUnspecified
-
adjustTimezone
-
add
-
addMinutes
-
addSeconds
-
add
Description copied from class:Numeric
Return this + k * obj. -
addReversed
Description copied from class:Numeric
Calculatex+k&this
.- Overrides:
addReversed
in classQuantity
-
toStringDate
-
toStringTime
-
isZoneUnspecified
public boolean isZoneUnspecified() -
getZoneMinutes
public int getZoneMinutes() -
minutesToTimeZone
Get a TimeZone object for a given offset.- Parameters:
minutes
- timezone offset in minutes.
-
setTimeZone
-
toStringZone
-
toStringZone
-
toString
-
toString
-
isExact
public boolean isExact() -
isZero
public boolean isZero() -
unit
-
number
-