Class Timestamp
java.lang.Object
org.openehealth.ipf.commons.ihe.xds.core.metadata.Timestamp
- All Implemented Interfaces:
Serializable
HL7 timestamps (data type DTM) with particular precision, normalized to UTC.
- Author:
- Dmytro Rud
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionTimestamp(ZonedDateTime dateTime, Timestamp.Precision precision) Initializes aTimestampobject with the given datetime and precision. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTwo HL7 timestamps are equal when they have the same values in the relevant fields (i.e. in the ones covered by the precision).static TimestampCreates aTimestampobject from the given string.Timestamp.inthashCode()static Timestampnow()voidsetDateTime(ZonedDateTime dateTime) voidsetPrecision(Timestamp.Precision precision) Precision of the timestamp (smallest present element, e.g.toHL7()static StringReturns a HL7 representation of the given timestamp, considering the precision.toString()
-
Constructor Details
-
Timestamp
public Timestamp() -
Timestamp
Initializes aTimestampobject with the given datetime and precision.
-
-
Method Details
-
fromHL7
Creates aTimestampobject from the given string.- Parameters:
s- String of the patternYYYY[MM[DD[HH[MM[SS[.S[S[S[S]]]]]]]]][+/-ZZZZ]. Milliseconds will be ignored.- Returns:
- a
Timestampobject, ornullif the parameter isnullor empty.
-
toHL7
Returns a HL7 representation of the given timestamp, considering the precision.- Parameters:
timestamp-Timestampobject, can benull.- Returns:
- HL7 representation of the timestamp, or
nullif the parameter isnull.
-
toHL7
-
setDateTime
-
getPrecision
-
now
- Returns:
- a
Timestampwith the current date-time in second precision.
-
equals
Two HL7 timestamps are equal when they have the same values in the relevant fields (i.e. in the ones covered by the precision). -
hashCode
public int hashCode() -
toString
-
getDateTime
Timestamp. -
setPrecision
Precision of the timestamp (smallest present element, e.g. YEAR for "1980").
-