import {ChronoLocalDateTime} from '@js-joda/root/packages/core/src/chrono/ChronoLocalDateTime.js'
ChronoLocalDateTime
Extends:
Direct Subclass:
A date-time without a time-zone in an arbitrary chronology, intended for advanced globalization use cases.
Most applications should declare method signatures, fields and variables as LocalDateTime, not this interface.
A ChronoLocalDateTime is the abstract representation of a local date-time where the Chronology, or calendar system, is pluggable. The date-time is defined in terms of fields expressed by TemporalField, where most common implementations are defined in ChronoField. The chronology defines how the calendar system operates and the meaning of the standard fields.
When to use this interface
The design of the API encourages the use of LocalDateTime rather than this interface, even in the case where the application needs to deal with multiple calendar systems. The rationale for this is explored in detail in ChronoLocalDate.
Ensure that the discussion in ChronoLocalDate has been read and understood before using this interface.
Specification for implementors
This interface must be implemented with care to ensure other classes operate correctly. All implementations that can be instantiated must be final, immutable and thread-safe. Subclasses should be Serializable wherever possible.
In JDK 8, this is an interface with default methods. Since there are no default methods in JDK 7, an abstract class is used.
Method Summary
Public Methods | ||
public |
adjustInto(temporal: *): * |
|
public |
chronology(): * Gets the chronology of this date-time. |
|
public |
query(query: TemporalQuery): * |
|
public |
toEpochSecond(offset: ZoneOffset): number Converts this date-time to the number of seconds from the epoch of 1970-01-01T00:00:00Z. |
|
public |
toInstant(offset: ZoneOffset): Instant Converts this date-time to an Instant. |
Inherited Summary
From class TemporalAccessor | ||
public |
get(field: TemporalField): number Gets the value of the specified field as an |
|
public |
getLong(field: *) |
|
public |
isSupported(field: *) |
|
public |
query(query: TemporalQuery): * Queries this date-time. |
|
public |
range(field: TemporalField): ValueRange Gets the range of valid values for the specified field. |
From class Temporal | ||
public |
isSupported(fieldOrUnit: TemporalUnit): boolean Checks if the specified unit is supported. |
|
public |
minus(amount: TemporalAmount | number, unit: TemporalUnit): Temporal function overloading for Temporal.plus |
|
public |
plus(amount: TemporalAmount | number, unit: TemporalUnit): Temporal function overloading for Temporal.plus |
|
public |
until(endTemporal: Temporal, unit: TemporalUnit): number Calculates the period between this temporal and another temporal in terms of the specified unit. |
|
public |
with(adjusterOrField: TemporalAdjuster | TemporalField, newValue: number): Temporal function overloading for Temporal.with |
Public Methods
public chronology(): * source
Gets the chronology of this date-time.
The Chronology represents the calendar system in use. The era and other fields in ChronoField are defined by the chronology.
Return:
* | the chronology, not null |
public query(query: TemporalQuery): * source
Queries this date-time.
This queries this date-time using the specified query strategy object.
Queries are a key tool for extracting information from date-times. They exists to externalize the process of querying, permitting different approaches, as per the strategy design pattern. Examples might be a query that checks if the date is the day before February 29th in a leap year, or calculates the number of days to your next birthday.
The most common query implementations are method references, such as LocalDate::from and ZoneId::from. Further implementations are on TemporalQueries. Queries may also be defined by applications.
Override:
TemporalAccessor#queryParams:
Name | Type | Attribute | Description |
query | TemporalQuery |
Return:
* |
public toEpochSecond(offset: ZoneOffset): number source
Converts this date-time to the number of seconds from the epoch of 1970-01-01T00:00:00Z.
This combines this local date-time and the specified offset to calculate the epoch-second value, which is the number of elapsed seconds from 1970-01-01T00:00:00Z. Instants on the time-line after the epoch are positive, earlier are negative.
Params:
Name | Type | Attribute | Description |
offset | ZoneOffset | the offset to use for the conversion, not null |
Return:
number | the number of seconds from the epoch of 1970-01-01T00:00:00Z |
public toInstant(offset: ZoneOffset): Instant source
Converts this date-time to an Instant.
This combines this local date-time and the specified offset to form an Instant.
Params:
Name | Type | Attribute | Description |
offset | ZoneOffset | the offset to use for the conversion, not null |