
Package ca.uhn.fhir.model.primitive
Class DateDt
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.DateDt
- All Implemented Interfaces:
IDatatype,IElement,IIdentifiableElement,IPrimitiveDatatype<Date>,ISupportsUndeclaredExtensions,Externalizable,Serializable,IBase,IBaseDatatype,IPrimitiveType<Date>
Represents a FHIR date datatype. Valid precisions values for this type are:
Note on using Java Date objects: This type stores the date as a Java Date. Note that the Java Date has more precision (millisecond precision), and does not store a timezone. As such, it could potentially cause issues. For example, if a Date contains the number of milliseconds at midnight in a timezone across the date line from your location, it might refer to a different date than intended.
As such, it is recommended to use the Calendar or int,int,int constructors
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TemporalPrecisionEnumThe default precision for this typeFields inherited from class ca.uhn.fhir.model.primitive.BaseDateTimeDt
NOW_DATE_CONSTANT, TODAY_DATE_CONSTANT -
Constructor Summary
ConstructorsConstructorDescriptionDateDt()ConstructorDateDt(int theYear, int theMonth, int theDay) Constructor which accepts a date value and uses theDEFAULT_PRECISIONfor this type.Constructor which accepts a date as a string in FHIR formatConstructor which accepts a date value and uses theDEFAULT_PRECISIONfor this type.Constructor which accepts a date value and uses theDEFAULT_PRECISIONfor this type.DateDt(Date theDate, TemporalPrecisionEnum thePrecision) Constructor which accepts a date value and a precision value. -
Method Summary
Modifier and TypeMethodDescriptionprotected TemporalPrecisionEnumReturns the default precision for this datatypeprotected booleanisPrecisionAllowed(TemporalPrecisionEnum thePrecision) To be implemented by subclasses to indicate whether the given precision is allowed by this typeMethods 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, toHumanDisplayLocalTimezoneMethods inherited from class ca.uhn.fhir.model.api.BasePrimitive
equals, getValue, getValueAsString, hashCode, hasValue, isEmpty, readExternal, toString, updateStringValue, writeExternalMethods inherited from class ca.uhn.fhir.model.api.BaseIdentifiableElement
getElementSpecificId, getId, setElementSpecificId, setId, setIdMethods inherited from class ca.uhn.fhir.model.api.BaseElement
addUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, getUserData, hasFormatComment, isBaseEmpty, setUserDataMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hl7.fhir.instance.model.api.IBase
fhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserData
-
Field Details
-
DEFAULT_PRECISION
The default precision for this type
-
-
Constructor Details
-
DateDt
public DateDt()Constructor -
DateDt
Constructor which accepts a date value and uses theDEFAULT_PRECISIONfor this type. -
DateDt
Constructor which accepts a date value and uses theDEFAULT_PRECISIONfor this type. Please see the note on timezones on theclass documentationfor considerations when using this constructor! -
DateDt
Constructor which accepts a date value and a precision value. Valid precisions values for this type are: Please see the note on timezones on theclass documentationfor considerations when using this constructor!- Throws:
DataFormatException- If the specified precision is not allowed for this type
-
DateDt
Constructor which accepts a date value and uses theDEFAULT_PRECISIONfor this type.- Parameters:
theYear- The year, e.g. 2015theMonth- The month, e.g. 0 for JanuarytheDay- The day (1 indexed) e.g. 1 for the first day of the month
-
DateDt
Constructor which accepts a date as a string in FHIR format- Throws:
DataFormatException- If the precision in the date string is not allowed for this type
-
-
Method Details
-
getDefaultPrecisionForDatatype
Returns the default precision for this datatype- Specified by:
getDefaultPrecisionForDatatypein classBaseDateTimeDt- See Also:
-
isPrecisionAllowed
Description copied from class:BaseDateTimeDtTo be implemented by subclasses to indicate whether the given precision is allowed by this type- Specified by:
isPrecisionAllowedin classBaseDateTimeDt
-