Package ca.uhn.fhir.model.primitive
Class DateTimeDt
- java.lang.Object
-
- ca.uhn.fhir.model.api.BaseElement
-
- ca.uhn.fhir.model.api.BaseIdentifiableElement
-
- ca.uhn.fhir.model.api.BasePrimitive<Date>
-
- ca.uhn.fhir.model.primitive.BaseDateTimeDt
-
- ca.uhn.fhir.model.primitive.DateTimeDt
-
- All Implemented Interfaces:
IDatatype,IElement,IIdentifiableElement,IPrimitiveDatatype<Date>,ISupportsUndeclaredExtensions,Externalizable,Serializable,IBase,IBaseDatatype,IPrimitiveType<Date>
public class DateTimeDt extends BaseDateTimeDt
Represents a FHIR dateTime datatype. Valid precisions values for this type are:- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static TemporalPrecisionEnumDEFAULT_PRECISIONThe default precision for this type-
Fields inherited from class ca.uhn.fhir.model.primitive.BaseDateTimeDt
NOW_DATE_CONSTANT
-
-
Constructor Summary
Constructors Constructor Description DateTimeDt()ConstructorDateTimeDt(String theValue)Create a new instance using a string date/timeDateTimeDt(Date theDate)Create a new DateTimeDt with seconds precision and the local time zoneDateTimeDt(Date theDate, TemporalPrecisionEnum thePrecision)Constructor which accepts a date value and a precision value.DateTimeDt(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone)Constructor which accepts a date value, precision value, and time zone.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TemporalPrecisionEnumgetDefaultPrecisionForDatatype()Returns the default precision for this datatypeprotected booleanisPrecisionAllowed(TemporalPrecisionEnum thePrecision)To be implemented by subclasses to indicate whether the given precision is allowed by this typestatic DateTimeDtwithCurrentTime()Returns a new instance of DateTimeDt with the current system time and SECOND precision and the system local time zone-
Methods inherited from class ca.uhn.fhir.model.primitive.BaseDateTimeDt
encode, getDay, getHour, getMillis, getMinute, getMonth, getNanos, getPrecision, getSecond, getTimeZone, getValueAsCalendar, getYear, isTimeZoneZulu, isToday, parse, setDay, setHour, setMillis, setMinute, setMonth, setNanos, setPrecision, setSecond, setTimeZone, setTimeZoneZulu, setValue, setValue, setValueAsString, setYear, toHumanDisplay, toHumanDisplayLocalTimezone
-
Methods inherited from class ca.uhn.fhir.model.api.BasePrimitive
equals, getValue, getValueAsString, hashCode, hasValue, isEmpty, readExternal, toString, updateStringValue, writeExternal
-
Methods inherited from class ca.uhn.fhir.model.api.BaseIdentifiableElement
getElementSpecificId, getId, setElementSpecificId, setId, setId
-
Methods inherited from class ca.uhn.fhir.model.api.BaseElement
addUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, getUserData, hasFormatComment, isBaseEmpty, setUserData
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hl7.fhir.instance.model.api.IBase
fhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserData
-
-
-
-
Field Detail
-
DEFAULT_PRECISION
public static final TemporalPrecisionEnum DEFAULT_PRECISION
The default precision for this type
-
-
Constructor Detail
-
DateTimeDt
public DateTimeDt()
Constructor
-
DateTimeDt
public DateTimeDt(Date theDate)
Create a new DateTimeDt with seconds precision and the local time zone
-
DateTimeDt
public DateTimeDt(Date theDate, TemporalPrecisionEnum thePrecision)
Constructor which accepts a date value and a precision value. Valid precisions values for this type are:- Throws:
DataFormatException- If the specified precision is not allowed for this type
-
DateTimeDt
public DateTimeDt(String theValue)
Create a new instance using a string date/time- Throws:
DataFormatException- If the specified precision is not allowed for this type
-
DateTimeDt
public DateTimeDt(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone)
Constructor which accepts a date value, precision value, and time zone. Valid precisions values for this type are:
-
-
Method Detail
-
isPrecisionAllowed
protected boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision)
Description copied from class:BaseDateTimeDtTo be implemented by subclasses to indicate whether the given precision is allowed by this type- Specified by:
isPrecisionAllowedin classBaseDateTimeDt
-
withCurrentTime
public static DateTimeDt withCurrentTime()
Returns a new instance of DateTimeDt with the current system time and SECOND precision and the system local time zone
-
getDefaultPrecisionForDatatype
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype()
Returns the default precision for this datatype- Specified by:
getDefaultPrecisionForDatatypein classBaseDateTimeDt- See Also:
DEFAULT_PRECISION
-
-