Top Description Fields Constructors Methods
org.hsqldb.types

public final Class DateTimeType

extends DTIType
Class Inheritance
Imports
java.math.BigDecimal, java.text.SimpleDateFormat, java.time.Instant, .LocalDate, .LocalDateTime, .LocalTime, .OffsetDateTime, .OffsetTime, .ZoneOffset, .ZonedDateTime, java.time.temporal.ChronoField, java.util.Calendar, .Date, .TimeZone, org.hsqldb.HsqlException, .OpTypes, .Session, .SessionInterface, .Tokens, org.hsqldb.error.Error, .ErrorCode, org.hsqldb.lib.HashSet, .StringConverter

Type subclass for DATE, TIME and TIMESTAMP.
Author
Fred Toussi (fredt@users dot sourceforge.net)
Since
1.9.0
Version
2.7.3

Field Summary

Modifier and TypeField and Description
public static final long
public static final TimestampData
public static final long
public static final TimestampData
private final String
public static final TimeZone
public final boolean
public static final HashSet<String>
Inherited from org.hsqldb.types.DTIType:
defaultIntervalFractionPrecisiondefaultIntervalPrecisiondefaultTimeFractionPrecisiondefaultTimestampFractionPrecisionendIntervalTypeendPartIndexINTERVAL_FRACTION_PART_INDEXINTERVAL_MONTH_INDEXINTERVAL_SECOND_INDEXintervalIndexMapintervalPartsintervalTypeslimitNanosecondsmaxFractionPrecisionmaxIntervalPrecisionmaxIntervalSecondPrecisionmillisInSecondnanoScaleFactorsnanosInMillinanosInSecondprecisionFactorsprecisionLimitssecondsInDaystartIntervalTypestartPartIndextimezoneSecondsLimityearToSecondFactorsyearToSecondLimitsyearToSecondSeparators

Constructor Summary

AccessConstructor and Description
public
DateTimeType(int typeGroup, int type, int scale)

Method Summary

Modifier and TypeMethod and Description
public boolean
public Object
add(Session session, Object a, Object b, Type otherType)

Overrides org.hsqldb.types.Type.add.

public static TimestampData
addMonths(Session session, TimestampData source, int months)

public Object
addMonthsSpecial(Session session, Object dateTime, int months)

public static TimeData
addSeconds(TimeData source, long seconds, int nanos)

public static TimestampData
addSeconds(TimestampData source, long seconds, int nanos)

public boolean
public boolean
public boolean
public int
canMoveFrom(Type otherType)

Overrides org.hsqldb.types.Type.canMoveFrom.

When canConvertFrom() is true, can convert without changing the object

public Object
changeZone(Session session, Object a, String zoneString)

public Object
changeZone(Session session, Object a, Type otherType, String zoneString)

public Object
changeZone(Session session, Object a, Type otherType, int zoneSeconds, boolean atLocal)

public Object
public int
compare(Session session, Object a, Object b)

Implements abstract org.hsqldb.types.Type.compare.

public static Boolean

Returns:

Boolean#TRUE if period a contains period b, else Boolean#FALSE
contains
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
,
boolean pointOfTime)

The predicate "x CONTAINS y" applies when a) both x and y are either period names or period constructors.

public TimestampData
convertFromDouble(Session session, double value)

pack-priv static String
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
public Object
pack-priv TimestampData
convertTimeToTimestamp(Calendar calendar, int timeSeconds, int nanos)

public static TimestampData
public Object
convertToDefaultType(SessionInterface session, Object a)

Implements abstract org.hsqldb.types.Type.convertToDefaultType.

Converts the object to the given type without limit checks.

public static double
public void
public String
public String
public Object
convertToType(SessionInterface session, Object a, Type otherType)

Implements abstract org.hsqldb.types.Type.convertToType.

Same as castToType except for CHARACTER values.

public Object
public int
public boolean
equals(Object other)

Overrides org.hsqldb.types.Type.equals.

Indicates whether some other object is "equal to" this one.

public static Boolean

Returns:

Boolean#TRUE if period a equals period b, else Boolean#FALSE
equals
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
)

The predicate "x EQUALS y" applies when both x and y are either period names or period constructors.

public Type
getAggregateType(Type other)

Implements abstract org.hsqldb.types.Type.getAggregateType.

Common type used in comparison operations.

public Type
getCombinedType(Session session, Type other, int operation)

Implements abstract org.hsqldb.types.Type.getCombinedType.

Result type of combining values of two types in different operations.

public static DateTimeType
getDateTimeType(int type, int scale)

public TimestampData
getDateTimeValue(SessionInterface session, long seconds, int nanos)

public static int
public String
getDefinition()

Implements abstract org.hsqldb.types.Type.getDefinition.

Returns the full definition of the type, including parameters

public Class<T>
public String
getJDBCClassName()

Implements abstract org.hsqldb.types.Type.getJDBCClassName.

Returns the JDBC class name of type, if it exists, otherwise the HSQLDB class name.

public int
public int
getJDBCTypeCode()

Implements abstract org.hsqldb.types.Type.getJDBCTypeCode.

Returns the JDBC type number of type, if it exists, otherwise the HSQLDB / SQL type.

public Object
getLastDayOfMonth(Session session, Object dateTime)

public String
getNameString()

Implements abstract org.hsqldb.types.Type.getNameString.

Returns the name of the type

private String
public int
getPart(Session session, Object dateTime, int part)

Implements abstract org.hsqldb.types.DTIType.getPart.

public String
getPartString(Session session, Object dateTime, int part)

public BigDecimal
getSecondPart(Session session, Object dateTime)

Implements abstract org.hsqldb.types.DTIType.getSecondPart.

public int
public int
getSQLGenericTypeCode()

Overrides org.hsqldb.types.Type.getSQLGenericTypeCode.

Returns the generic SQL CLI type number of type, if it exists, otherwise the HSQLDB type.

pack-priv long
pack-priv long
pack-priv long
public static int
getZoneSeconds(long utcSeconds, TimeZone zone)

public static Boolean

Returns:

Boolean#TRUE if period a immediately precedes period b, else Boolean#FALSE
immediatelyPrecedes
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
)

The predicate "x IMMEDIATELY PRECEDES y" applies when both x and y are either period names or period constructors.

public static Boolean

Returns:

Boolean#TRUE if period a immediately succeeds period b, else Boolean#FALSE
immediatelySucceeds
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
)

The predicate "x IMMEDIATELY SUCCEEDS y" applies when both x and y are either period names or period constructors.

public boolean
public boolean
public boolean
public boolean
public boolean
public static TimestampData
public static TimestampData
public static TimestampData
public static TimestampData
public static TimestampData
nextDayOfWeek(Session session, TimestampData d, int day)

public static Type

Returns:

The common data type of the boundaries of the two limits. null if any of the two periods is null or if the first limit of any period is null.
normalizeInput
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
,
boolean pointOfTime)

For temporal predicate operations on periods, we need to make sure we compare data of the same types.

public static Type

Returns:

The common data type of the boundaries of the two limits. null if any of the two periods is null or if the first limit of any period is null.
normalizeInputRelaxed
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
)

For temporal predicate operations on periods, we need to make sure we compare data of the same types.

public static Boolean

Returns:

Boolean#TRUE if the two periods overlaps, else Boolean#FALSE
overlaps
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
)

The predicate "a OVERLAPS b" applies when both a and b are either period names or period constructors.

public static Boolean

Returns:

Boolean#TRUE if the two periods overlaps, else Boolean#FALSE
overlapsRelaxed
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
)

The predicate "a OVERLAPS b" applies when both a and b are rows.

public static Boolean

Returns:

Boolean#TRUE if period a precedes period b, else Boolean#FALSE
precedes
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
)

The predicate "a PRECEDES b" applies when both a and b are either period names or period constructors.

public Object
round(Session session, Object a, int part)

pack-priv int
scaleNanos(int nanos)

public static void
public static void
pack-priv static void
setTimeComponents(Calendar calendar, int seconds)

pack-priv static void
setTimeComponentsOnly(Calendar calendar, int seconds)

public Object
subtract(Session session, Object a, Object b, Type otherType)

Overrides org.hsqldb.types.Type.subtract.

public static int
subtractMonths(Session session, TimestampData a, TimestampData b, boolean isYear)

public static BigDecimal
public static Boolean

Returns:

Boolean#TRUE if period a succeeds period b, else Boolean#FALSE
succeeds
(Session
The session
session
,
Object[]
First period to compare
a
,
Type[]
Types of the first period
ta
,
Object[]
Second period to compare
b
,
Type[]
Type of the second period
tb
)

The predicate "x SUCCEEDS y" applies when both x and y are either period names or period constructors.

public static TimestampData
public static TimeData
public static TimeData
pack-priv static long
toDateSeconds(long seconds)

public Instant
public LocalDate
public LocalDateTime
public LocalTime
public LocalTime
public static TimestampData
toLocalTimestampValue(TimestampData tsWithZone)

Session derivatives of CURRENT_TIMESTAMP

public OffsetDateTime
public OffsetTime
public OffsetTime
public static int
toTimeSeconds(long seconds)

public Object
truncate(Session session, Object a, int part)

Inherited from org.hsqldb.types.DTIType:
getEndIntervalTypegetExtractTypegetFieldNameTokenForTypegetFieldNameTypeForTokengetPrecisionExponentgetSecondPartgetStartIntervalTypeintervalSecondToStringisValidDatetimeRangenormaliseFractionnormaliseFraction