public class MCdateTime
extends java.lang.Object
This class provides the functionality to parse and compose a DICOM value according to the definition of DT value representation.
Instances of this class can be used by multiple threads concurrently.
Constructor and Description |
---|
MCdateTime(MCdate date,
MCtime time)
Initializes a new instance of this class using a date and a time object.
|
MCdateTime(MCdate date,
MCtime time,
java.lang.String plusMinus,
java.lang.Integer hoursOffset,
java.lang.Integer minutesOffset)
Initializes a new instance of this class using a date and a time object.
|
MCdateTime(java.lang.String dateTimeStr)
Initializes a new instance of this class with a DICOM date/time string
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compares this date/time instance to another object.
|
MCdate |
getDate()
Gets the date portion of this date/time object.
|
java.lang.String |
getOffset()
Gets the optional hours/minutes offset from Coordinated Universal Time (UTC).
|
MCtime |
getTime()
Gets the time portion of this date/time object.
|
java.lang.String |
toString()
Retrieves the date/time as it would be sent on a DICOM stream.
|
public MCdateTime(MCdate date, MCtime time)
Using this constructor insures a properly formatted DICOM date/time string.
date
- The date portion of the date/time to create.time
- The time portion of the date/time to create. This parameter can be null
.MCexception
- If a parameter is invalid.public MCdateTime(MCdate date, MCtime time, java.lang.String plusMinus, java.lang.Integer hoursOffset, java.lang.Integer minutesOffset)
date
- The date portion of the date/time to create.time
- The time portion of the date/time to create. This parameter can be null
.plusMinus
- The sign of the offset from Coordinated Universal Time (UTC), "+", "-" or null
.hoursOffset
- The hours offset from Coordinated Universal Time (UTC), an integer between 0
and 59 inclusive.minutesOffset
- The minutes offset from Coordinated Universal Time (UTC), an integer between
0 and 59 inclusive.MCexception
- If a parameter is invalid.public MCdateTime(java.lang.String dateTimeStr)
If the provided string is not formated according to the rules for the DT
value representation this method does not throw an exception, however any method of the
constructed object, except toString()
, will throw an exception.
dateTimeStr
- The date/time string in the YYYYMMDDHHMMSS.FFFFFF&ZZXX format.MCexception
- If the argument is null
.public MCdate getDate()
MCdate
object representing the date portion.public java.lang.String getOffset()
The returned string begins with either a plus(+) or minus(-) sign.
public MCtime getTime()
MCtime
object representing the time portion of this date/time, or
null
if the time portion is not specified.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare to.true
if the provided object is an MCdateTime
instance and the
string representation of both objects are equal.