Record Class DateTime
java.lang.Object
java.lang.Record
org.eclipse.milo.opcua.stack.core.types.builtin.DateTime
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DateTimeMaximum DateTime that can be represented on this "DevelopmentPlatform".static final InstantMinimumInstantthat can be formatted in ISO-8601, i.e. "0001-01-01T00:00:00Z".static final StringMaximum ISO-8601 formatted string.static final DateTimeMinimum DateTime that can be represented on this "DevelopmentPlatform".static final InstantMinimumInstantthat can be formatted in ISO-8601, i.e. "0001-01-01T00:00:00Z".static final StringMinimum ISO-8601 formatted string.static final DateTimestatic final DateTimestatic booleanWhentrue,now()will use nanosecond precision. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.longlonginthashCode()Returns a hash code value for this object.booleanbooleanCheck if this is not a "null" DateTime.booleanisNull()Check if this is a "null" DateTime.booleanisValid()static DateTimenow()Get aDateTimeinitialized to now.static DateTimestatic DateTimenowNanos()toString()Returns a string representation of this record class.longutcTime()Returns the value of theutcTimerecord component.
-
Field Details
-
MIN_ISO_8601_STRING
Minimum ISO-8601 formatted string.- See Also:
-
MAX_ISO_8601_STRING
Maximum ISO-8601 formatted string.- See Also:
-
MIN_ISO_8601_INSTANT
MinimumInstantthat can be formatted in ISO-8601, i.e. "0001-01-01T00:00:00Z". -
MAX_ISO_8601_INSTANT
MinimumInstantthat can be formatted in ISO-8601, i.e. "0001-01-01T00:00:00Z". -
MIN_DATE_TIME
Minimum DateTime that can be represented on this "DevelopmentPlatform". -
MAX_DATE_TIME
Maximum DateTime that can be represented on this "DevelopmentPlatform". -
USE_NANOS
public static volatile boolean USE_NANOSWhentrue,now()will use nanosecond precision. -
MIN_VALUE
-
NULL_VALUE
-
-
Constructor Details
-
DateTime
public DateTime() -
DateTime
-
DateTime
-
DateTime
public DateTime(long utcTime) Creates an instance of aDateTimerecord class.- Parameters:
utcTime- the value for theutcTimerecord component
-
-
Method Details
-
getUtcTime
public long getUtcTime()- Returns:
- this time as 100 nanosecond intervals since UTC epoch.
-
getJavaTime
public long getJavaTime()- Returns:
- this time as milliseconds since Java epoch.
-
getJavaDate
- Returns:
- this time as a
Date.
-
getJavaInstant
- Returns:
- this time as an
Instant.
-
isValid
public boolean isValid() -
isInvalid
public boolean isInvalid() -
isNull
public boolean isNull()Check if this is a "null" DateTime.A "null" DateTime has a `utcTime` of 0, i.e. it is equivalent to the ISO-8601 date "1601-01-01T00:00:00Z".
- Returns:
trueif this DateTime is "null",falseotherwise.
-
isNotNull
public boolean isNotNull()Check if this is not a "null" DateTime.- Returns:
trueif this DateTime is not "null",falseotherwise.
-
toIso8601String
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
now
- Returns:
- a
DateTimeinitialized to now.
-
nowMillis
- Returns:
- a
DateTimeinitialized to now with millisecond precision.
-
nowNanos
- Returns:
- a
DateTimeinitialized to now with nanosecond precision.
-
utcTime
public long utcTime()Returns the value of theutcTimerecord component.- Returns:
- the value of the
utcTimerecord component
-