public abstract class BaseDateTimeDt extends BasePrimitive<Date>
| Constructor and Description |
|---|
BaseDateTimeDt()
Constructor
|
BaseDateTimeDt(Date theDate,
TemporalPrecisionEnum thePrecision)
Constructor
|
BaseDateTimeDt(Date theDate,
TemporalPrecisionEnum thePrecision,
TimeZone theTimeZone)
Constructor
|
BaseDateTimeDt(String theString)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
encode(Date theValue)
Subclasses must override to convert a "coerced" value into an encoded one.
|
Integer |
getDay()
Returns the month with 1-index, e.g.
|
protected abstract TemporalPrecisionEnum |
getDefaultPrecisionForDatatype()
Returns the default precision for the given datatype
|
Integer |
getHour()
Returns the hour of the day in a 24h clock, e.g.
|
Integer |
getMillis()
Returns the milliseconds within the current second.
|
Integer |
getMinute()
Returns the minute of the hour in the range 0-59
|
Integer |
getMonth()
Returns the month with 0-index, e.g.
|
Long |
getNanos()
Returns the nanoseconds within the current second
|
TemporalPrecisionEnum |
getPrecision()
Gets the precision for this datatype (using the default for the given type if not set)
|
Integer |
getSecond()
Returns the second of the minute in the range 0-59
|
TimeZone |
getTimeZone()
Returns the TimeZone associated with this dateTime's value.
|
GregorianCalendar |
getValueAsCalendar()
Returns the value of this object as a
GregorianCalendar |
Integer |
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 type
|
boolean |
isTimeZoneZulu()
Returns true if the timezone is set to GMT-0:00 (Z)
|
boolean |
isToday()
Returns
true if this object represents a date that is today's date |
protected Date |
parse(String theValue)
Subclasses must override to convert an encoded representation of this datatype into a "coerced" one
|
BaseDateTimeDt |
setDay(int theDay)
Sets the month with 1-index, e.g.
|
BaseDateTimeDt |
setHour(int theHour)
Sets the hour of the day in a 24h clock, e.g.
|
BaseDateTimeDt |
setMillis(int theMillis)
Sets the milliseconds within the current second.
|
BaseDateTimeDt |
setMinute(int theMinute)
Sets the minute of the hour in the range 0-59
|
BaseDateTimeDt |
setMonth(int theMonth)
Sets the month with 0-index, e.g.
|
BaseDateTimeDt |
setNanos(long theNanos)
Sets the nanoseconds within the current second
|
BaseDateTimeDt |
setPrecision(TemporalPrecisionEnum thePrecision)
Sets the precision for this datatype
|
BaseDateTimeDt |
setSecond(int theSecond)
Sets the second of the minute in the range 0-59
|
BaseDateTimeDt |
setTimeZone(TimeZone theTimeZone) |
BaseDateTimeDt |
setTimeZoneZulu(boolean theTimeZoneZulu) |
BaseDateTimeDt |
setValue(Date theValue)
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) |
BaseDateTimeDt |
setYear(int theYear)
Sets the year, e.g.
|
String |
toHumanDisplay()
Returns a human readable version of this date/time using the system local format.
|
String |
toHumanDisplayLocalTimezone()
Returns a human readable version of this date/time using the system local format, converted to the local timezone
if neccesary.
|
equals, getValue, getValueAsString, hashCode, isEmpty, readExternal, toString, updateStringValue, writeExternalgetElementSpecificId, getId, setElementSpecificId, setId, setIdaddUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, hasFormatComment, isBaseEmptyclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetFormatCommentsPost, getFormatCommentsPre, hasFormatCommentpublic BaseDateTimeDt()
public BaseDateTimeDt(Date theDate, TemporalPrecisionEnum thePrecision)
DataFormatException - If the specified precision is not allowed for this typepublic BaseDateTimeDt(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimeZone)
public BaseDateTimeDt(String theString)
DataFormatException - If the specified precision is not allowed for this typeprotected String encode(Date theValue)
BasePrimitiveencode in class BasePrimitive<Date>theValue - Will not be nullprotected abstract TemporalPrecisionEnum getDefaultPrecisionForDatatype()
public Integer getMillis()
Note that this method returns the
same value as getNanos() but with less precision.
public Long getNanos()
Note that this method returns the
same value as getMillis() but with more precision.
public TemporalPrecisionEnum getPrecision()
setPrecision(TemporalPrecisionEnum)public TimeZone getTimeZone()
null if no timezone was
supplied.public GregorianCalendar getValueAsCalendar()
GregorianCalendarprotected abstract boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision)
public boolean isTimeZoneZulu()
public boolean isToday()
true if this object represents a date that is today's dateNullPointerException - if BasePrimitive.getValue() returns nullprotected Date parse(String theValue) throws DataFormatException
BasePrimitiveparse in class BasePrimitive<Date>theValue - Will not be nullDataFormatExceptionpublic BaseDateTimeDt setDay(int theDay)
public BaseDateTimeDt setHour(int theHour)
public BaseDateTimeDt setMillis(int theMillis)
Note that this method sets the
same value as setNanos(long) but with less precision.
public BaseDateTimeDt setMinute(int theMinute)
public BaseDateTimeDt setMonth(int theMonth)
public BaseDateTimeDt setNanos(long theNanos)
Note that this method sets the
same value as setMillis(int) but with more precision.
public BaseDateTimeDt setPrecision(TemporalPrecisionEnum thePrecision) throws DataFormatException
DataFormatExceptionpublic BaseDateTimeDt setSecond(int theSecond)
public BaseDateTimeDt setTimeZone(TimeZone theTimeZone)
public BaseDateTimeDt setTimeZoneZulu(boolean theTimeZoneZulu)
public BaseDateTimeDt setValue(Date theValue)
setValue in interface IPrimitiveDatatype<Date>setValue in interface IPrimitiveType<Date>setValue in class BasePrimitive<Date>public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws DataFormatException
theValue - The date valuethePrecision - The precisionDataFormatExceptionpublic void setValueAsString(String theValue) throws DataFormatException
setValueAsString in interface IPrimitiveDatatype<Date>setValueAsString in interface IPrimitiveType<Date>setValueAsString in class BasePrimitive<Date>DataFormatExceptionpublic BaseDateTimeDt setYear(int theYear)
public String toHumanDisplay()
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.
public String toHumanDisplayLocalTimezone()
Copyright © 2014–2017 University Health Network. All rights reserved.