public class DateTimeValue
extends java.lang.Object
java.sql.Date
, java.sql.Time
and
java.sql.Timestamp
, which are based on java.util.Date
, this
class does not represent the time as an offset from midnight,
January 1, 1970 GMT. Instead, it holds each component (year, month, day,
hour, minute, second, nanosecond) as it would have been represented in a
given calendar. Since it does not hold information about the time zone for
the time it represents, it does not point to a well-defined point in time
without being used together with a java.util.Calendar
object.Modifier and Type | Field | Description |
---|---|---|
private int |
day |
|
private int |
hours |
|
private int |
minutes |
|
private int |
month |
|
private int |
nanos |
|
private int |
seconds |
|
private int |
year |
Modifier | Constructor | Description |
---|---|---|
|
DateTimeValue(java.sql.Date date) |
Create an instance from a
java.sql.Date using the default
calendar. |
(package private) |
DateTimeValue(java.sql.Date date,
java.util.Calendar cal) |
Create an instance from a
java.sql.Timestamp using the specified
java.util.Calendar . |
|
DateTimeValue(java.sql.Time time) |
Create an instance from a
java.sql.Time using the default
calendar. |
(package private) |
DateTimeValue(java.sql.Time time,
java.util.Calendar cal) |
Create an instance from a
java.sql.Time using the specified
java.util.Calendar . |
|
DateTimeValue(java.sql.Timestamp ts) |
Create an instance from a
java.sql.Timestamp using the default
calendar. |
(package private) |
DateTimeValue(java.sql.Timestamp ts,
java.util.Calendar cal) |
Create an instance from a
java.sql.Timestamp using the specified
java.util.Calendar . |
private |
DateTimeValue(java.util.Calendar cal,
int nanoFraction) |
Construct a
DateTimeValue from a java.util.Calendar . |
Modifier and Type | Method | Description |
---|---|---|
int |
getDayOfMonth() |
Get day of month component.
|
int |
getHours() |
Get hour of day component (24 hour clock).
|
int |
getMinutes() |
Get minute component.
|
int |
getMonth() |
Get the month component.
|
int |
getNanos() |
Get nanosecond component.
|
int |
getSeconds() |
Get second component.
|
int |
getYear() |
Get the year component.
|
private static java.util.Calendar |
initCalendar(java.util.Calendar cal,
java.util.Date date) |
Set the time of a calendar.
|
private final int year
private final int month
private final int day
private final int hours
private final int minutes
private final int seconds
private final int nanos
private DateTimeValue(java.util.Calendar cal, int nanoFraction)
DateTimeValue
from a java.util.Calendar
.cal
- the calendar from which to get the values of the fieldsnanoFraction
- the nano second fraction of a second (the
milliseconds will be taken from cal
, so only the six least
significant digits of this value are used)DateTimeValue(java.sql.Date date, java.util.Calendar cal)
java.sql.Timestamp
using the specified
java.util.Calendar
.DateTimeValue(java.sql.Time time, java.util.Calendar cal)
java.sql.Time
using the specified
java.util.Calendar
.DateTimeValue(java.sql.Timestamp ts, java.util.Calendar cal)
java.sql.Timestamp
using the specified
java.util.Calendar
.public DateTimeValue(java.sql.Date date)
java.sql.Date
using the default
calendar.public DateTimeValue(java.sql.Time time)
java.sql.Time
using the default
calendar.public DateTimeValue(java.sql.Timestamp ts)
java.sql.Timestamp
using the default
calendar.private static java.util.Calendar initCalendar(java.util.Calendar cal, java.util.Date date)
cal
- the calendardate
- an object representing the new time of the calendarcal
)public int getYear()
public int getMonth()
Calendar.JANUARY
).public int getDayOfMonth()
public int getHours()
public int getMinutes()
public int getSeconds()
public int getNanos()
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.