public class Timestamp extends Timestamp
Differs from java.sql.Timestamp when
serialized/deserialized in different timezones.
By default, if timestamps are serialized and deserialized in different timezones,
their representation may differ according to the GMT-offset and/or daylight saving.
This is okay for most cases. In some cases, however, a timestamp
should not be converted, i.e. regarded as fixed and related to some
timezone by convention, for example UTC. This is what the UTC-attribute
and the tentackle model's [UTC]-option is provided for.
| Constructor and Description |
|---|
Timestamp()
Creates the current timestamp.
|
Timestamp(long time)
Constructs a
Timestamp object using a milliseconds time value. |
| Modifier and Type | Method and Description |
|---|---|
Calendar |
getCalendar()
Gets the calendar for this date.
|
boolean |
isUTC()
Gets the UTC flag.
|
void |
setTime(long timestamp) |
void |
setUTC(boolean utc)
Sets the UTC flag.
|
after, before, compareTo, compareTo, equals, equals, from, getNanos, getTime, hashCode, setNanos, toInstant, toLocalDateTime, toString, valueOf, valueOfafter, before, clone, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTimezoneOffset, getYear, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setYear, toGMTString, toLocaleString, UTCpublic Timestamp(long time)
Timestamp object using a milliseconds time value. The integral
seconds are stored in the underlying date value; the fractional seconds are
stored in the
nanos field of the
Timestamp object.time - milliseconds since January 1, 1970, 00:00:00 GMT. A negative
number is the number of milliseconds before January 1, 1970, 00:00:00 GMT.Calendarpublic Timestamp()
public void setUTC(boolean utc)
Timestamps with UTC set are serialized and deserialized without timezone.
utc - the UTC flagpublic boolean isUTC()
public Calendar getCalendar()
Tentackle - a domain driven enterprise framework