@CalendarType(value="iso8601") public final class PlainTimestamp extends TimePoint<IsoUnit,PlainTimestamp> implements GregorianDate, WallTime, Temporal<PlainTimestamp>
Represents a plain composition of calendar date and wall time as defined in ISO-8601, but without any timezone.
Following elements which are declared as constants are registered by this class:
PlainDate.COMPONENTPlainDate.YEARPlainDate.YEAR_OF_WEEKDATEPlainDate.QUARTER_OF_YEARPlainDate.MONTH_OF_YEARPlainDate.MONTH_AS_NUMBERPlainDate.DAY_OF_MONTHPlainDate.DAY_OF_QUARTERPlainDate.DAY_OF_WEEKPlainDate.DAY_OF_YEARPlainDate.WEEKDAY_IN_MONTHPlainTime.COMPONENTPlainTime.AM_PM_OF_DAYPlainTime.CLOCK_HOUR_OF_AMPMPlainTime.CLOCK_HOUR_OF_DAYPlainTime.DIGITAL_HOUR_OF_AMPMPlainTime.DIGITAL_HOUR_OF_DAYPlainTime.ISO_HOURPlainTime.MINUTE_OF_HOURPlainTime.MINUTE_OF_DAYPlainTime.SECOND_OF_MINUTEPlainTime.SECOND_OF_DAYPlainTime.MILLI_OF_SECONDPlainTime.MICRO_OF_SECONDPlainTime.NANO_OF_SECONDPlainTime.MILLI_OF_DAYPlainTime.MICRO_OF_DAYPlainTime.NANO_OF_DAYFurthermore, all elements of class Weekmodel are supported. As
timestamp units can be used: CalendarUnit and ClockUnit.
Note: The special time value 24:00 is only supported in the factory methods which normalize the resulting timestamp to midnight of the following day. In element access and manipulations this value is not supported.
| Modifier and Type | Method and Description |
|---|---|
Moment |
at(Timezone tz)
Deprecated.
use
in(Timezone) |
Moment |
at(ZonalOffset offset)
Combines this local timestamp with the given timezone offset
to a global timestamp.
|
Moment |
atStdTimezone()
Deprecated.
use
inStdTimezone() |
Moment |
atTimezone(TZID tzid)
Deprecated.
use
inTimezone(TZID) |
Moment |
atUTC()
Combines this local timestamp with the timezone offset UTC+00:00
to a global timestamp.
|
static TimeAxis<IsoUnit,PlainTimestamp> |
axis()
Provides a static access to the associated time axis respective
chronology which contains the chronological rules.
|
int |
compareTo(PlainTimestamp timestamp)
Defines the temporal order of date and time as natural order.
|
boolean |
equals(Object obj)
Compares the whole state of this instance with given object.
|
static ChronoFormatter<PlainTimestamp> |
formatter(String formatPattern,
ChronoPattern patternType,
Locale locale)
Creates a new formatter which uses the given pattern and locale
for formatting and parsing plain timestamps.
|
PlainDate |
getCalendarDate()
Provides the calendar date part.
|
int |
getDayOfMonth()
Yields the day of month.
|
int |
getHour()
Yields the hour of day.
|
int |
getMinute()
Liefert die Minute (der aktuellen Stunde).
|
int |
getMonth()
Yields the gregorian month as integer.
|
int |
getNanosecond()
Yields the nanosecond.
|
int |
getSecond()
Yields the second of minute.
|
PlainTime |
getWallTime()
Provides the wall time part.
|
int |
getYear()
Yields the proleptic year according to ISO-8601.
|
int |
hashCode()
Subclasses must redefine this method corresponding to the
behaviour of
equals(). |
Moment |
in(Timezone tz)
Combines this local timestamp with given timezone to a global
timestamp.
|
Moment |
inStdTimezone()
Combines this local timestamp with the system timezone to a global
timestamp.
|
Moment |
inTimezone(TZID tzid)
Combines this local timestamp with given timezone to a global
timestamp.
|
boolean |
isAfter(PlainTimestamp timestamp)
Queries if this object is after given object on a timeline.
|
boolean |
isBefore(PlainTimestamp timestamp)
Queries if this object is before given object on a timeline.
|
boolean |
isSimultaneous(PlainTimestamp timestamp)
Queries if this object and given object have the same position
on the time axis.
|
boolean |
isValid(TZID tzid)
Does this local timestamp exist in given timezone?
|
static ChronoFormatter<PlainTimestamp> |
localFormatter(String formatPattern,
ChronoPattern patternType)
Creates a new formatter which uses the given pattern in the
default locale for formatting and parsing plain timestamps.
|
static PlainTimestamp |
of(int year,
int month,
int dayOfMonth,
int hour,
int minute)
Creates a new local timestamp in minute precision.
|
static PlainTimestamp |
of(int year,
int month,
int dayOfMonth,
int hour,
int minute,
int second)
Creates a new local timestamp in second precision.
|
static PlainTimestamp |
of(PlainDate date,
PlainTime time)
Creates a new local timestamp with calendar date and wall time.
|
String |
toString()
Creates a canonical representation of the form
"yyyy-MM-dd'T'HH:mm:ss,fffffffff".
|
PlainTimestamp |
with(ElementOperator<?> operator)
Adjusts this timestamp by given operator.
|
PlainTimestamp |
with(PlainDate date)
Adjusts the calendar part of this timestamp.
|
PlainTimestamp |
with(PlainTime time)
Adjusts the wall time part of this timestamp.
|
max, min, minus, minus, plus, plus, until, untilcontains, get, get, getMaximum, getMinimum, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, withpublic static PlainTimestamp of(PlainDate date, PlainTime time)
Creates a new local timestamp with calendar date and wall time.
The special time value 24:00 will automatically normalized such that the resulting timestamp is on starting midnight of following day.
date - calendar date componenttime - wall time component (24:00 will always be normalized)of(int, int, int, int, int),
of(int, int, int, int, int, int)public static PlainTimestamp of(int year, int month, int dayOfMonth, int hour, int minute)
Creates a new local timestamp in minute precision.
The special time value 24:00 will automatically normalized such that the resulting timestamp is on starting midnight of following day.
year - proleptic iso year [(-999,999,999)-999,999,999]month - gregorian month in range (1-12)dayOfMonth - day of month in range (1-31)hour - hour in the range 0-23 or 24
if minute and second are equal to 0minute - minute in the range 0-59public static PlainTimestamp of(int year, int month, int dayOfMonth, int hour, int minute, int second)
Creates a new local timestamp in second precision.
The special time value 24:00 will automatically normalized such that the resulting timestamp is on starting midnight of following day.
year - proleptic iso year [(-999,999,999)-999,999,999]month - gregorian month in range (1-12)dayOfMonth - day of month in range (1-31)hour - hour in the range 0-23 or 24
if minute and second are equal to 0minute - minute in the range 0-59second - second in the range 0-59public PlainDate getCalendarDate()
Provides the calendar date part.
public PlainTime getWallTime()
Provides the wall time part.
public int getYear()
GregorianDateYields the proleptic year according to ISO-8601.
The term proleptic means that the gregorian calendar rules are applied backwards even before the introduction of this calendar. Second: The year numbering is just the mathematical one as defined in ISO-8601 such that there is a year zero and even negative years: -2 = BC 3, -1 = BC 2, 0 = BC 1, 1 = AD 1, 2 = AD 2, ...
getYear in interface GregorianDateGregorianMath.MIN_YEAR - GregorianMath.MAX_YEARpublic int getMonth()
GregorianDateYields the gregorian month as integer.
getMonth in interface GregorianDatepublic int getDayOfMonth()
GregorianDateYields the day of month.
getDayOfMonth in interface GregorianDate1 <= dayOfMonth <= 31public int getHour()
WallTimeYields the hour of day.
public int getMinute()
WallTimeLiefert die Minute (der aktuellen Stunde).
public int getSecond()
WallTimeYields the second of minute.
Given this context and the fact that this interface describes
an analogue clock without UTC reference, the special leapsecond
value 60 cannot be supported.
public int getNanosecond()
WallTimeYields the nanosecond.
Implementations which are not capable of nanosecond precision
will just yield 0 or another suitable rounded value.
getNanosecond in interface WallTime0 - 999,999,999public PlainTimestamp with(ElementOperator<?> operator)
Adjusts this timestamp by given operator.
operator - element-related operatorChronoEntity.with(net.time4j.engine.ChronoOperator)public PlainTimestamp with(PlainDate date)
Adjusts the calendar part of this timestamp.
date - new calendar date componentpublic PlainTimestamp with(PlainTime time)
Adjusts the wall time part of this timestamp.
time - new wall time componentpublic boolean isBefore(PlainTimestamp timestamp)
TemporalQueries if this object is before given object on a timeline.
isBefore in interface Temporal<PlainTimestamp>timestamp - object this instance is compared totrue if this instance is temporally before
temporal else falsepublic boolean isAfter(PlainTimestamp timestamp)
TemporalQueries if this object is after given object on a timeline.
isAfter in interface Temporal<PlainTimestamp>timestamp - object this instance is compared totrue if this instance is temporally after
temporal else falsepublic boolean isSimultaneous(PlainTimestamp timestamp)
TemporalQueries if this object and given object have the same position on the time axis.
Is equivalent to !isAfter(temporal) && !isBefore(temporal).
This method differs from the Object-method equals()
such that first the comparison type must be a temporal one and second
that only temporal-only state will be considered.
isSimultaneous in interface Temporal<PlainTimestamp>timestamp - object this instance is compared totrue if this instance is temporally equal
to temporal else falsepublic int compareTo(PlainTimestamp timestamp)
Defines the temporal order of date and time as natural order.
The comparison is consistent with equals().
compareTo in interface Comparable<PlainTimestamp>compareTo in class TimePoint<IsoUnit,PlainTimestamp>isBefore(PlainTimestamp),
isAfter(PlainTimestamp)public boolean equals(Object obj)
TimePointCompares the whole state of this instance with given object.
Implementations will usually define their state only based on the temporal position on the time axis because this is the most intuitive approach. Exceptions from this rule should be explicitly documented and reasoned.
equals in class TimePoint<IsoUnit,PlainTimestamp>TimePoint.compareTo(TimePoint)public int hashCode()
TimePointSubclasses must redefine this method corresponding to the
behaviour of equals().
hashCode in class TimePoint<IsoUnit,PlainTimestamp>public String toString()
Creates a canonical representation of the form "yyyy-MM-dd'T'HH:mm:ss,fffffffff".
Dependent on the precision (that is last non-zero part of time) the time representation might be shorter.
toString in interface GregorianDatetoString in interface WallTimetoString in class TimePoint<IsoUnit,PlainTimestamp>PlainTime.toString()public static ChronoFormatter<PlainTimestamp> localFormatter(String formatPattern, ChronoPattern patternType)
Creates a new formatter which uses the given pattern in the default locale for formatting and parsing plain timestamps.
Note: The formatter can be adjusted to other locales however.
formatPattern - format definition as patternpatternType - pattern dialectPlainTimestamp-objects
using system localeIllegalArgumentException - if resolving of pattern failsPatternType,
ChronoFormatter.with(Locale)public static ChronoFormatter<PlainTimestamp> formatter(String formatPattern, ChronoPattern patternType, Locale locale)
Creates a new formatter which uses the given pattern and locale for formatting and parsing plain timestamps.
Note: The formatter can be adjusted to other locales however.
formatPattern - format definition as patternpatternType - pattern dialectlocale - locale settingPlainTimestamp-objects
using given localeIllegalArgumentException - if resolving of pattern failsPatternType,
localFormatter(String,ChronoPattern)public static TimeAxis<IsoUnit,PlainTimestamp> axis()
Provides a static access to the associated time axis respective chronology which contains the chronological rules.
null)public Moment atUTC()
Combines this local timestamp with the timezone offset UTC+00:00 to a global timestamp.
at(ZonalOffset)public Moment at(ZonalOffset offset)
Combines this local timestamp with the given timezone offset to a global timestamp.
offset - timezone offsetatUTC(),
in(Timezone)public Moment inStdTimezone()
Combines this local timestamp with the system timezone to a global timestamp.
Timezone.ofSystem(),
inTimezone(TZID)public Moment inTimezone(TZID tzid)
Combines this local timestamp with given timezone to a global timestamp.
tzid - timezone idIllegalArgumentException - if given timezone cannot be loadedTimezone.of(TZID),
inStdTimezone()public Moment in(Timezone tz)
Combines this local timestamp with given timezone to a global timestamp.
tz - timezoneTimezone.of(String)@Deprecated public Moment atStdTimezone()
inStdTimezone()Combines this local timestamp with the system timezone to a global timestamp.
@Deprecated public Moment atTimezone(TZID tzid)
inTimezone(TZID)Combines this local timestamp with given timezone to a global timestamp.
tzid - timezone idIllegalArgumentException - if given timezone cannot be loaded@Deprecated public Moment at(Timezone tz)
in(Timezone)Combines this local timestamp with given timezone to a global timestamp.
tz - timezonepublic boolean isValid(TZID tzid)
Does this local timestamp exist in given timezone?
tzid - timezone idtrue if this timestamp is valid in given timezoneIllegalArgumentException - if given timezone cannot be loadedCopyright © 2014. All rights reserved.