Class DateType

  • All Implemented Interfaces:
    ca.uhn.fhir.model.api.IElement, Externalizable, Serializable, org.hl7.fhir.instance.model.api.IBase, org.hl7.fhir.instance.model.api.IBaseDatatype, org.hl7.fhir.instance.model.api.IBaseElement, org.hl7.fhir.instance.model.api.IBaseHasExtensions, org.hl7.fhir.instance.model.api.IPrimitiveType<Date>

    public class DateType
    extends BaseDateTimeType
    Represents a FHIR date datatype. Valid precisions values for this type are:
    • TemporalPrecisionEnum.YEAR
    • TemporalPrecisionEnum.MONTH
    • TemporalPrecisionEnum.DAY
    See Also:
    Serialized Form
    • Field Detail

      • DEFAULT_PRECISION

        public static final ca.uhn.fhir.model.api.TemporalPrecisionEnum DEFAULT_PRECISION
        The default precision for this type
    • Constructor Detail

      • DateType

        public DateType()
        Constructor
      • DateType

        public DateType​(Date theDate,
                        ca.uhn.fhir.model.api.TemporalPrecisionEnum thePrecision)
        Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
        • TemporalPrecisionEnum.YEAR
        • TemporalPrecisionEnum.MONTH
        • TemporalPrecisionEnum.DAY
        Throws:
        ca.uhn.fhir.parser.DataFormatException - If the specified precision is not allowed for this type
      • DateType

        public DateType​(String theDate)
        Constructor which accepts a date as a string in FHIR format
        Throws:
        ca.uhn.fhir.parser.DataFormatException - If the precision in the date string is not allowed for this type
      • DateType

        public DateType​(int theYear,
                        int theMonth,
                        int theDay)
        Constructor which accepts a date value and uses the DEFAULT_PRECISION for this type.

        Use caution when using this constructor: The month is 0-indexed but the day is 1-indexed in order to match the bahaviour of the Java Calendar type.

        Parameters:
        theYear - The year, e.g. 2015
        theMonth - The month, e.g. 0 for January
        theDay - The day (1 indexed) e.g. 1 for the first day of the month