public class Date extends Date implements Freezable
Differs from java.sql.Date when
serialized/deserialized in different timezones. Databases don't provide a
time and therefore no timezone for a date, i.e. when sent over wire to different
locations a date should always remain the same for all timezones. In
java.sql.Data, however, the epochal time is serialized which may lead
to a different date when deserialized in another timezone. In Date
the effective date is serialized as YYYYMMDD to provide the same semantics
as databases do.
Furthermore, tentackle dates can be frozen, i.e. made immutable.
| Constructor and Description |
|---|
Date()
Creates the current date.
|
Date(long date)
Constructs a
Date object using the given milliseconds time value. |
| Modifier and Type | Method and Description |
|---|---|
Date |
clone() |
static Date |
createFrozen(long epoch)
Creates a frozen date.
|
void |
freeze()
Makes this object immutable.
|
Calendar |
getCalendar()
Gets the calendar for this date.
|
void |
setDate(int date) |
void |
setHours(int hours) |
void |
setMinutes(int minutes) |
void |
setMonth(int month) |
void |
setSeconds(int seconds) |
void |
setTime(long date) |
void |
setYear(int year) |
getHours, getMinutes, getSeconds, toInstant, toLocalDate, toString, valueOf, valueOfafter, before, compareTo, equals, from, getDate, getDay, getMonth, getTime, getTimezoneOffset, getYear, hashCode, parse, toGMTString, toLocaleString, UTCpublic Date(long date)
Date object using the given milliseconds time value. If the
given milliseconds value contains time information, the driver will set the
time components to the time in the default time zone (the time zone of the
Java virtual machine running the application) that corresponds to zero GMT.date - milliseconds since January 1, 1970, 00:00:00 GMT not to exceed
the milliseconds representation for the year 8099. A negative number
indicates the number of milliseconds before January 1, 1970, 00:00:00 GMT.public Date()
public static Date createFrozen(long epoch)
epoch - epochal milliseconds since January 1, 1970, 00:00:00 GMTpublic Calendar getCalendar()
public void freeze()
Freezablepublic void setTime(long date)
Overridden to clear the lazy calendar and to check for frozen.
public void setMinutes(int minutes)
setMinutes in class Datepublic void setSeconds(int seconds)
setSeconds in class DateTentackle - distributed, domain- and model-driven