Class BaseDateTimeDt
- All Implemented Interfaces:
IDatatype
,IElement
,IIdentifiableElement
,IPrimitiveDatatype<Date>
,ISupportsUndeclaredExtensions
,Externalizable
,Serializable
,IBase
,IBaseDatatype
,IPrimitiveType<Date>
- Direct Known Subclasses:
DateDt
,DateParam.DateParamDateTimeHolder
,DateTimeDt
,InstantDt
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructorBaseDateTimeDt
(String theString) ConstructorBaseDateTimeDt
(Date theDate, TemporalPrecisionEnum thePrecision) ConstructorBaseDateTimeDt
(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimeZone) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Subclasses must override to convert a "coerced" value into an encoded one.getDay()
Returns the month with 1-index, e.g.protected abstract TemporalPrecisionEnum
Returns the default precision for the given datatypegetHour()
Returns the hour of the day in a 24h clock, e.g.Returns the milliseconds within the current second.Returns the minute of the hour in the range 0-59getMonth()
Returns the month with 0-index, e.g.getNanos()
Returns the nanoseconds within the current secondGets the precision for this datatype (using the default for the given type if not set)Returns the second of the minute in the range 0-59Returns the TimeZone associated with this dateTime's value.Returns the value of this object as aGregorianCalendar
getYear()
Returns the year, e.g.protected abstract boolean
isPrecisionAllowed
(TemporalPrecisionEnum thePrecision) To be implemented by subclasses to indicate whether the given precision is allowed by this typeboolean
Returns true if the timezone is set to GMT-0:00 (Z)boolean
isToday()
Returnstrue
if this object represents a date that is today's dateprotected Date
Subclasses must override to convert an encoded representation of this datatype into a "coerced" onesetDay
(int theDay) Sets the month with 1-index, e.g.setHour
(int theHour) Sets the hour of the day in a 24h clock, e.g.setMillis
(int theMillis) Sets the milliseconds within the current second.setMinute
(int theMinute) Sets the minute of the hour in the range 0-59setMonth
(int theMonth) Sets the month with 0-index, e.g.setNanos
(long theNanos) Sets the nanoseconds within the current secondsetPrecision
(TemporalPrecisionEnum thePrecision) Sets the precision for this datatypesetSecond
(int theSecond) Sets the second of the minute in the range 0-59setTimeZone
(TimeZone theTimeZone) setTimeZoneZulu
(boolean theTimeZoneZulu) Sets the value for this type using the given Java Date object as the time, and using the default precision for this datatype (unless the precision is already set), as well as the local timezone as determined by the local operating system.void
setValue
(Date theValue, TemporalPrecisionEnum thePrecision) Sets the value for this type using the given Java Date object as the time, and using the specified precision, as well as the local timezone as determined by the local operating system.void
setValueAsString
(String theValue) setYear
(int theYear) Sets the year, e.g.Returns a human readable version of this date/time using the system local format.Returns a human readable version of this date/time using the system local format, converted to the local timezone if neccesary.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 Details
-
NOW_DATE_CONSTANT
- See Also:
-
TODAY_DATE_CONSTANT
- See Also:
-
-
Constructor Details
-
BaseDateTimeDt
public BaseDateTimeDt()Constructor -
BaseDateTimeDt
Constructor- Throws:
DataFormatException
- If the specified precision is not allowed for this type
-
BaseDateTimeDt
Constructor -
BaseDateTimeDt
Constructor- Throws:
DataFormatException
- If the specified precision is not allowed for this type
-
-
Method Details
-
encode
Description copied from class:BasePrimitive
Subclasses must override to convert a "coerced" value into an encoded one.- Specified by:
encode
in classBasePrimitive<Date>
- Parameters:
theValue
- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
getDay
Returns the month with 1-index, e.g. 1=the first day of the month -
getDefaultPrecisionForDatatype
Returns the default precision for the given datatype -
getHour
Returns the hour of the day in a 24h clock, e.g. 13=1pm -
getMillis
Returns the milliseconds within the current second.Note that this method returns the same value as
getNanos()
but with less precision. -
getMinute
Returns the minute of the hour in the range 0-59 -
getMonth
Returns the month with 0-index, e.g. 0=January -
getNanos
Returns the nanoseconds within the current secondNote that this method returns the same value as
getMillis()
but with more precision. -
getPrecision
Gets the precision for this datatype (using the default for the given type if not set)- See Also:
-
getSecond
Returns the second of the minute in the range 0-59 -
getTimeZone
Returns the TimeZone associated with this dateTime's value. May returnnull
if no timezone was supplied. -
getValueAsCalendar
Returns the value of this object as aGregorianCalendar
-
getYear
Returns the year, e.g. 2015 -
isPrecisionAllowed
To be implemented by subclasses to indicate whether the given precision is allowed by this type -
isTimeZoneZulu
Returns true if the timezone is set to GMT-0:00 (Z) -
isToday
Returnstrue
if this object represents a date that is today's date- Throws:
NullPointerException
- ifBasePrimitive.getValue()
returnsnull
-
parse
Description copied from class:BasePrimitive
Subclasses must override to convert an encoded representation of this datatype into a "coerced" one- Specified by:
parse
in classBasePrimitive<Date>
- Parameters:
theValue
- Will not be null- Returns:
- May return null if the value does not correspond to anything
- Throws:
DataFormatException
-
setDay
Sets the month with 1-index, e.g. 1=the first day of the month -
setHour
Sets the hour of the day in a 24h clock, e.g. 13=1pm -
setMillis
Sets the milliseconds within the current second.Note that this method sets the same value as
setNanos(long)
but with less precision. -
setMinute
Sets the minute of the hour in the range 0-59 -
setMonth
Sets the month with 0-index, e.g. 0=January -
setNanos
Sets the nanoseconds within the current secondNote that this method sets the same value as
setMillis(int)
but with more precision. -
setPrecision
Sets the precision for this datatype- Throws:
DataFormatException
-
setSecond
Sets the second of the minute in the range 0-59 -
setTimeZone
-
setTimeZoneZulu
-
setValue
Sets the value for this type using the given Java Date object as the time, and using the default precision for this datatype (unless the precision is already set), as well as the local timezone as determined by the local operating system. Both of these properties may be modified in subsequent calls if neccesary.- Specified by:
setValue
in interfaceIPrimitiveDatatype<Date>
- Specified by:
setValue
in interfaceIPrimitiveType<Date>
- Overrides:
setValue
in classBasePrimitive<Date>
-
setValue
Sets the value for this type using the given Java Date object as the time, and using the specified precision, as well as the local timezone as determined by the local operating system. Both of these properties may be modified in subsequent calls if neccesary.- Parameters:
theValue
- The date valuethePrecision
- The precision- Throws:
DataFormatException
-
setValueAsString
- Specified by:
setValueAsString
in interfaceIPrimitiveDatatype<Date>
- Specified by:
setValueAsString
in interfaceIPrimitiveType<Date>
- Overrides:
setValueAsString
in classBasePrimitive<Date>
- Throws:
DataFormatException
-
setYear
Sets the year, e.g. 2015 -
toHumanDisplay
Returns a human readable version of this date/time using the system local format.Note on time zones: This method renders the value using the time zone that is contained within the value. For example, if this date object contains the value "2012-01-05T12:00:00-08:00", the human display will be rendered as "12:00:00" even if the application is being executed on a system in a different time zone. If this behaviour is not what you want, use
toHumanDisplayLocalTimezone()
instead. -
toHumanDisplayLocalTimezone
Returns a human readable version of this date/time using the system local format, converted to the local timezone if neccesary.- See Also:
-