Modifier and Type | Method and Description |
---|---|
static GlobalDateTime |
castOptional(DataValue value)
For internal use only.
|
static GlobalDateTime |
castRequired(DataValue value)
For internal use only.
|
static int |
compare(GlobalDateTime left,
GlobalDateTime right)
Compare two dateTime values.
|
int |
compareTo(GlobalDateTime value)
Compare this dateTime with another dateTime.
|
static boolean |
equal(GlobalDateTime left,
GlobalDateTime right)
Compare two dateTime values.
|
boolean |
equals(java.lang.Object value)
Compare this dateTime value with another dateTime value.
|
DataType |
getDataType()
Data type of the wrapped value.
|
LocalDate |
getDate()
Local date component of dateTime.
|
int |
getDay()
Day field of date (1 to 31).
|
int |
getDayOfWeek()
Day of week (1 to 7).
|
int |
getDayOfYear()
Day of year (1 to 366).
|
int |
getHour()
Hour field of time (0 to 23).
|
int |
getMinute()
Minute field of time (0 to 59).
|
int |
getMonth()
Month field of date (1 to 12).
|
int |
getNano()
Nanosecond field of time (0 to 999999999).
|
int |
getOffset()
Time zone offset in minutes (-840 to 840).
|
int |
getSecond()
Second field of time (0 to 59).
|
LocalTime |
getTime()
Local time component of dateTime.
|
int |
getYear()
Year field of date.
|
boolean |
greaterEqual(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
|
boolean |
greaterThan(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
|
int |
hashCode()
Hash this data value to a number.
|
boolean |
lessEqual(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
|
boolean |
lessThan(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
|
static long |
millisBetween(GlobalDateTime a,
GlobalDateTime b)
Return the difference in milliseconds between two dateTime values
a and b , calculated as b - a . |
double |
minus(GlobalDateTime value)
Return the difference
this - value , measured in days. |
GlobalDateTime |
normalize()
Normalize this dateTime value to UTC.
|
boolean |
notEqual(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
|
static GlobalDateTime |
now()
Return the current global dateTime.
|
static GlobalDateTime |
of(int year,
int month,
int day,
int hour,
int minute,
int second)
|
static GlobalDateTime |
of(int year,
int month,
int day,
int hour,
int minute,
int second,
int nano)
Return a new dateTime value.
|
static GlobalDateTime |
ofMillis(long ms)
Convert a Java 'millis' time value to a GlobalDateTime.
|
static GlobalDateTime |
parse(java.lang.String text)
|
GlobalDateTime |
plusDays(int days)
Return a new dateTime which is the specified number of days ahead of this dateTime.
|
GlobalDateTime |
plusHours(long hours)
Return a new dateTime which is the specified number of hours ahead of this dateTime.
|
GlobalDateTime |
plusMicros(long micros)
Return a new dateTime which is the specified number of microseconds ahead of this dateTime.
|
GlobalDateTime |
plusMillis(long millis)
Return a new dateTime which is the specified number of milliseconds ahead of this dateTime.
|
GlobalDateTime |
plusMinutes(long minutes)
Return a new dateTime which is the specified number of minutes ahead of this dateTime.
|
GlobalDateTime |
plusMonths(int months)
Return a new dateTime/time which is the specified number of months ahead of this dateTime.
|
GlobalDateTime |
plusNanos(long nanos)
Return a new dateTime which is the specified number of nanoseconds ahead of this dateTime.
|
GlobalDateTime |
plusSeconds(long seconds)
Return a new dateTime which is the specified number of seconds ahead of this dateTime.
|
GlobalDateTime |
plusWeeks(int weeks)
Return a new dateTime which is the specified number of weeks ahead of this dateTime.
|
GlobalDateTime |
plusYears(int years)
Return a new dateTime which is the specified number of years ahead of this dateTime.
|
static boolean |
static_greaterEqual(GlobalDateTime left,
GlobalDateTime right)
Compare two dateTime values.
|
static boolean |
static_greaterThan(GlobalDateTime left,
GlobalDateTime right)
Compare two dateTime values.
|
static boolean |
static_lessEqual(GlobalDateTime left,
GlobalDateTime right)
Compare two dateTime values.
|
static boolean |
static_lessThan(GlobalDateTime left,
GlobalDateTime right)
Compare two dateTime values.
|
static boolean |
static_notEqual(GlobalDateTime left,
GlobalDateTime right)
Compare two dateTime values.
|
LocalDateTime |
toLocal()
Return this local date and time portion of this value, without zone offset.
|
static long |
toMillis(GlobalDateTime dt)
Convert a GlobalDateTime to a Java 'millis' time value.
|
java.lang.String |
toString()
Convert this data value to a string.
|
GlobalDateTime |
zone(int offset)
Return a new dateTime value, with all fields the same as the current dateTime value except for the zone offset.
|
cloneMutable, getTypeCode
public static GlobalDateTime castOptional(DataValue value)
For internal use only.
public static GlobalDateTime castRequired(DataValue value)
For internal use only.
public static int compare(GlobalDateTime left, GlobalDateTime right)
Compare two dateTime values.
left
- The first dateTime for comparison.right
- The second dateTime for comparison.left < right
, 0 if left == right
, or 1 if left > right
.public int compareTo(GlobalDateTime value)
Compare this dateTime with another dateTime.
value
- The other dateTime.public static boolean equal(GlobalDateTime left, GlobalDateTime right)
Compare two dateTime values.
left
- (nullable) The first dateTime for comparison.right
- (nullable) The second dateTime for comparison.true
if left
is equal to right
, otherwise false
.public boolean equals(java.lang.Object value)
Compare this dateTime value with another dateTime value.
public DataType getDataType()
Data type of the wrapped value.
getDataType
in class DataValue
public LocalDate getDate()
Local date component of dateTime.
public int getDay()
Day field of date (1 to 31).
public int getDayOfWeek()
Day of week (1 to 7).
public int getDayOfYear()
Day of year (1 to 366).
public int getHour()
Hour field of time (0 to 23).
public int getMinute()
Minute field of time (0 to 59).
public int getMonth()
Month field of date (1 to 12).
public int getNano()
Nanosecond field of time (0 to 999999999).
public int getOffset()
Time zone offset in minutes (-840 to 840).
public int getSecond()
Second field of time (0 to 59).
public LocalTime getTime()
Local time component of dateTime.
public int getYear()
Year field of date.
public boolean greaterEqual(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
value
- The other dateTime value.true
if this dateTime value is greater than or equal to the value dateTime value. Oherwise false
.public boolean greaterThan(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
value
- The other dateTime value.true
if this dateTime value is greater than the value dateTime value. Oherwise false
.public int hashCode()
Hash this data value to a number.
public boolean lessEqual(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
value
- The other dateTime value.true
if this dateTime value is less than or equal to the value dateTime value. Oherwise false
.public boolean lessThan(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
value
- The other dateTime value.true
if this dateTime value is less than the value dateTime value. Oherwise false
.public static long millisBetween(GlobalDateTime a, GlobalDateTime b)
Return the difference in milliseconds between two dateTime values a
and b
, calculated as b - a
.
a
- The first dateTime value.b
- The second dateTime value.a
and b
, calculated as b - a
.public double minus(GlobalDateTime value)
Return the difference this - value
, measured in days.
value
- The other dateTime.this - value
, measured in days.public GlobalDateTime normalize()
Normalize this dateTime value to UTC. For example "2000-01-01T14:00:00+12:00" would normalize to "2000-01-01T02:00:00Z"
GlobalDateTime.offset
is zero.public boolean notEqual(GlobalDateTime value)
Compare this dateTime value with another dateTime value.
value
- The other dateTime value.true
if this dateTime value is not equal to the value dateTime value. Oherwise false
.public static GlobalDateTime now()
Return the current global dateTime.
public static GlobalDateTime of(int year, int month, int day, int hour, int minute, int second)
public static GlobalDateTime of(int year, int month, int day, int hour, int minute, int second, int nano)
Return a new dateTime value.
year
- The year field.month
- The month field (1 to 12).day
- The day field (1 to 31).hour
- The hour field (0 to 23).minute
- The minute field (0 to 59).second
- The second field (0 to 59).nano
- The nano field (0 to 999999999).public static GlobalDateTime ofMillis(long ms)
Convert a Java 'millis' time value to a GlobalDateTime.
ms
- Milliseconds since 1970-01-01T00:00:00Z (UTC).public static GlobalDateTime parse(java.lang.String text)
Return (nullable) Value parsed from XML Schema format, or null
if text
has invalid dateTime format.
text
- Value in XML Schema format.null
if text
has invalid dateTime format.public GlobalDateTime plusDays(int days)
Return a new dateTime which is the specified number of days ahead of this dateTime.
days
- Number of days to add. Can be negative, zero or positive.public GlobalDateTime plusHours(long hours)
Return a new dateTime which is the specified number of hours ahead of this dateTime.
hours
- Number of hours to add. Can be negative, zero or positive.public GlobalDateTime plusMicros(long micros)
Return a new dateTime which is the specified number of microseconds ahead of this dateTime.
micros
- Number of microseconds to add. Can be negative, zero or positive.public GlobalDateTime plusMillis(long millis)
Return a new dateTime which is the specified number of milliseconds ahead of this dateTime.
millis
- Number of milliseconds to add. Can be negative, zero or positive.public GlobalDateTime plusMinutes(long minutes)
Return a new dateTime which is the specified number of minutes ahead of this dateTime.
minutes
- Number of minutes to add. Can be negative, zero or positive.public GlobalDateTime plusMonths(int months)
Return a new dateTime/time which is the specified number of months ahead of this dateTime.
months
- Number of months to add. Can be negative, zero or positive.public GlobalDateTime plusNanos(long nanos)
Return a new dateTime which is the specified number of nanoseconds ahead of this dateTime.
nanos
- Number of nanoseconds to add. Can be negative, zero or positive.public GlobalDateTime plusSeconds(long seconds)
Return a new dateTime which is the specified number of seconds ahead of this dateTime.
seconds
- Number of seconds to add. Can be negative, zero or positive.public GlobalDateTime plusWeeks(int weeks)
Return a new dateTime which is the specified number of weeks ahead of this dateTime.
weeks
- Number of weeks to add. Can be negative, zero or positive.public GlobalDateTime plusYears(int years)
Return a new dateTime which is the specified number of years ahead of this dateTime.
years
- Number of years to add. Can be negative, zero or positive.public static boolean static_greaterEqual(GlobalDateTime left, GlobalDateTime right)
Compare two dateTime values.
left
- The first dateTime for comparison.right
- The second dateTime for comparison.true
if left
is greater than or equal to right
, otherwise false
.public static boolean static_greaterThan(GlobalDateTime left, GlobalDateTime right)
Compare two dateTime values.
left
- The first dateTime for comparison.right
- The second dateTime for comparison.true
if left
is greater than right
, otherwise false
.public static boolean static_lessEqual(GlobalDateTime left, GlobalDateTime right)
Compare two dateTime values.
left
- The first dateTime for comparison.right
- The second dateTime for comparison.true
if left
is less than or equal to right
, otherwise false
.public static boolean static_lessThan(GlobalDateTime left, GlobalDateTime right)
Compare two dateTime values.
left
- The first dateTime for comparison.right
- The second dateTime for comparison.true
if left
is less than right
, otherwise false
.public static boolean static_notEqual(GlobalDateTime left, GlobalDateTime right)
Compare two dateTime values.
left
- (nullable) The first dateTime for comparison.right
- (nullable) The second dateTime for comparison.true
if left
is not equal to right
, otherwise false
.public LocalDateTime toLocal()
Return this local date and time portion of this value, without zone offset.
public static long toMillis(GlobalDateTime dt)
Convert a GlobalDateTime to a Java 'millis' time value.
dt
- Global date/time.public java.lang.String toString()
Convert this data value to a string.
If the GlobalDateTime.dataType
is defined by XML Schema Part 2: Datatypes, then the corresponding lexical format is used.
JSON format is used for structured values (arrays and objects).
public GlobalDateTime zone(int offset)
Return a new dateTime value, with all fields the same as the current dateTime value except for the zone offset.
offset
- Zone offset in minutes (-840 to 840).