Top Description Fields Constructors Methods
org.apache.derby.client.am

public Class DateTimeValue

extends Object
Class Inheritance
Imports
java.sql.Date, .Time, .Timestamp, java.util.Calendar

This class represents a date or time value as it is represented in the database. In contrast to 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.

Field Summary

Modifier and TypeField and Description
private final int
private final int
private final int
private final int
private final int
private final int
private final int

Constructor Summary

AccessConstructor and Description
private
DateTimeValue(Calendar
the calendar from which to get the values of the fields
cal
,
int
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)
nanoFraction
)

Construct a DateTimeValue from a java.util.Calendar.

pack-priv
DateTimeValue(Date date, Calendar cal)

Create an instance from a java.sql.Timestamp using the specified java.util.Calendar.

pack-priv
DateTimeValue(Time time, Calendar cal)

Create an instance from a java.sql.Time using the specified java.util.Calendar.

pack-priv
DateTimeValue(Timestamp ts, Calendar cal)

Create an instance from a java.sql.Timestamp using the specified java.util.Calendar.

public
DateTimeValue(Date
The wrapped date
date
)

Create an instance from a java.sql.Date using the default calendar.

public
DateTimeValue(Time
The wrapped time value
time
)

Create an instance from a java.sql.Time using the default calendar.

public
DateTimeValue(Timestamp
The wrapped timestamp value
ts
)

Create an instance from a java.sql.Timestamp using the default calendar.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

day of month component
getDayOfMonth
()

Get day of month component.

public int

Returns:

hour of day component
getHours
()

Get hour of day component (24 hour clock).

public int

Returns:

minute component.
getMinutes
()

Get minute component.

public int

Returns:

the month component
getMonth
()

Get the month component.

public int

Returns:

nanosecond component.
getNanos
()

Get nanosecond component.

public int

Returns:

second component.
getSeconds
()

Get second component.

public int

Returns:

the year component.
getYear
()

Get the year component.

private static Calendar

Returns:

the calendar (same as cal)
initCalendar
(Calendar
the calendar
cal
,
Date
an object representing the new time of the calendar
date
)

Set the time of a calendar.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dayback to summary
private final int day
hoursback to summary
private final int hours
minutesback to summary
private final int minutes
monthback to summary
private final int month
nanosback to summary
private final int nanos
secondsback to summary
private final int seconds
yearback to summary
private final int year

Constructor Detail

DateTimeValueback to summary
private DateTimeValue(Calendar cal, int nanoFraction)

Construct a DateTimeValue from a java.util.Calendar.

Parameters
cal:Calendar

the calendar from which to get the values of the fields

nanoFraction:int

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)

DateTimeValueback to summary
pack-priv DateTimeValue(Date date, Calendar cal)

Create an instance from a java.sql.Timestamp using the specified java.util.Calendar.

DateTimeValueback to summary
pack-priv DateTimeValue(Time time, Calendar cal)

Create an instance from a java.sql.Time using the specified java.util.Calendar.

DateTimeValueback to summary
pack-priv DateTimeValue(Timestamp ts, Calendar cal)

Create an instance from a java.sql.Timestamp using the specified java.util.Calendar.

DateTimeValueback to summary
public DateTimeValue(Date date)

Create an instance from a java.sql.Date using the default calendar.

Parameters
date:Date

The wrapped date

DateTimeValueback to summary
public DateTimeValue(Time time)

Create an instance from a java.sql.Time using the default calendar.

Parameters
time:Time

The wrapped time value

DateTimeValueback to summary
public DateTimeValue(Timestamp ts)

Create an instance from a java.sql.Timestamp using the default calendar.

Parameters
ts:Timestamp

The wrapped timestamp value

Method Detail

getDayOfMonthback to summary
public int getDayOfMonth()

Get day of month component. First day of the month is 1.

Returns:int

day of month component

getHoursback to summary
public int getHours()

Get hour of day component (24 hour clock).

Returns:int

hour of day component

getMinutesback to summary
public int getMinutes()

Get minute component.

Returns:int

minute component.

getMonthback to summary
public int getMonth()

Get the month component. First month is 0 (Calendar.JANUARY).

Returns:int

the month component

getNanosback to summary
public int getNanos()

Get nanosecond component.

Returns:int

nanosecond component.

getSecondsback to summary
public int getSeconds()

Get second component.

Returns:int

second component.

getYearback to summary
public int getYear()

Get the year component.

Returns:int

the year component.

initCalendarback to summary
private static Calendar initCalendar(Calendar cal, Date date)

Set the time of a calendar.

Parameters
cal:Calendar

the calendar

date:Date

an object representing the new time of the calendar

Returns:Calendar

the calendar (same as cal)