public class DateTimeAttribute extends StringAttribute
A concrete class specializing Attribute for
Date Time (DT) attributes.
Though an instance of this class may be created
using its constructors, there is also a factory class, AttributeFactory.
Attribute,
AttributeFactory,
AttributeListspecificCharacterSetvalueLength, valueMultiplicity| Constructor and Description |
|---|
DateTimeAttribute(AttributeTag t)
Construct an (empty) attribute.
|
DateTimeAttribute(AttributeTag t,
long vl,
DicomInputStream i)
Read an attribute from an input stream.
|
DateTimeAttribute(AttributeTag t,
Long vl,
DicomInputStream i)
Read an attribute from an input stream.
|
| Modifier and Type | Method and Description |
|---|---|
static Date |
getDateFromFormattedString(AttributeList list,
AttributeTag dateTag,
AttributeTag timeTag)
|
static Date |
getDateFromFormattedString(String dateString)
|
static String |
getFormattedString(Date date)
Deprecated.
use
getFormattedStringDefaultTimeZone() instead |
static String |
getFormattedString(Date date,
TimeZone timezone)
|
static String |
getFormattedString(Date date,
TimeZone timezone,
boolean tzSuffix)
|
static String |
getFormattedStringDefaultTimeZone(Date date)
|
static String |
getFormattedStringUTC(Date date)
|
static long |
getTimeInMilliSecondsSinceEpoch(AttributeList list,
AttributeTag dateTag,
AttributeTag timeTag)
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the combination of the DA and TM values of the specified pair of attributes.
|
static long |
getTimeInMilliSecondsSinceEpoch(String dateTime)
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the DT value.
|
static TimeZone |
getTimeZone(String dicomTimeZone)
|
byte[] |
getVR()
Get the value representation of this attribute (DT).
|
addValue, addValue, addValue, addValue, addValue, addValue, addValue, getByteValues, getDoubleValues, getFloatValues, getIntegerValues, getLongValues, getOriginalStringValues, getPadByte, getPaddedVL, getShortValues, getSpecificCharacterSet, getStringValues, removeValues, setSpecificCharacterSet, toString, translateByteArrayToString, translateStringToByteArray, writegetDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrDefault, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrEmptyString, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDelimitedStringValuesOrNull, getDoubleValues, getDoubleValues, getElement, getFloatValues, getFloatValues, getGroup, getIntegerValues, getIntegerValues, getLongValues, getLongValues, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleDoubleValueOrDefault, getSingleFloatValueOrDefault, getSingleFloatValueOrDefault, getSingleFloatValueOrDefault, getSingleIntegerValueOrDefault, getSingleIntegerValueOrDefault, getSingleIntegerValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleLongValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrDefault, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrEmptyString, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getSingleStringValueOrNull, getStringValues, getStringValues, getStringValues, getStringValues, getStringValues, getTag, getVL, getVM, getVRAsString, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValues, setValues, setValues, setValues, toString, writeBasepublic DateTimeAttribute(AttributeTag t)
Construct an (empty) attribute.
t - the tag of the attributepublic DateTimeAttribute(AttributeTag t, long vl, DicomInputStream i) throws IOException, DicomException
Read an attribute from an input stream.
t - the tag of the attributevl - the value length of the attributei - the input streamIOExceptionDicomExceptionpublic DateTimeAttribute(AttributeTag t, Long vl, DicomInputStream i) throws IOException, DicomException
Read an attribute from an input stream.
t - the tag of the attributevl - the value length of the attributei - the input streamIOExceptionDicomExceptionpublic byte[] getVR()
Get the value representation of this attribute (DT).
getVR in class AttributeValueRepresentationpublic static String getFormattedString(Date date, TimeZone timezone, boolean tzSuffix)
public static String getFormattedStringUTC(Date date)
Get a DICOM format DT String value from a Java Date.
Will format the Date for the UTC timezone, converting from whatever timezone is specified in the supplied Date if not UTC.
date - the Java Date to formatpublic static String getFormattedStringDefaultTimeZone(Date date)
Get a DICOM format DT String value from a Java Date.
Will format the Date for the default timezone, converting from whatever timezone is specified in the supplied Date if not the default.
date - the Java Date to formatpublic static String getFormattedString(Date date)
getFormattedStringDefaultTimeZone() insteadGet a DICOM format DT String value from a Java Date.
Will format the Date for the default timezone, converting from whatever timezone is specified in the supplied Date if not the default.
date - the Java Date to formatpublic static Date getDateFromFormattedString(String dateString) throws ParseException
dateString - the date to parseDateParseExceptionpublic static Date getDateFromFormattedString(AttributeList list, AttributeTag dateTag, AttributeTag timeTag) throws ParseException, DicomException
Get a Java Date from a DICOM format DT String value.
Will use the TimezoneOffsetFromUTC if present in the AttributeList, else will assume UTC (not whatever the local time zone happens to be).
list - the list containing the attributesdateTag - the tag of the DA attributetimeTag - the tag of the TM attributeDateParseExceptionDicomException - if date attribute is missing or emptypublic static long getTimeInMilliSecondsSinceEpoch(String dateTime) throws ParseException
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the DT value.
dateTime - the string to parseParseExceptionpublic static long getTimeInMilliSecondsSinceEpoch(AttributeList list, AttributeTag dateTag, AttributeTag timeTag) throws ParseException, DicomException
Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the combination of the DA and TM values of the specified pair of attributes.
Will use the TimezoneOffsetFromUTC if present in the AttributeList, else will assume UTC (not whatever the local time zone happens to be).
list - the list containing the attributesdateTag - the tag of the DA attributetimeTag - the tag of the TM attributeParseExceptionDicomException - if date attribute is missing or empty