LocalDateTime Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
A date-time without a time-zone in the ISO-8601 calendar system,
such as 2007-12-03T10:15:30.
[Android.Runtime.Register("java/time/LocalDateTime", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class LocalDateTime : Java.Lang.Object, IDisposable, Java.IO.ISerializable, Java.Time.Chrono.IChronoLocalDateTime
[<Android.Runtime.Register("java/time/LocalDateTime", ApiSince=26, DoNotGenerateAcw=true)>]
type LocalDateTime = class
inherit Object
interface ISerializable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface IChronoLocalDateTime
interface IComparable
interface ITemporal
interface ITemporalAccessor
interface ITemporalAdjuster
- Inheritance
- Attributes
- Implements
Remarks
A date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.
LocalDateTime is an immutable date-time object that represents a date-time, often viewed as year-month-day-hour-minute-second. Other date and time fields, such as day-of-year, day-of-week and week-of-year, can also be accessed. Time is represented to nanosecond precision. For example, the value "2nd October 2007 at 13:45.30.123456789" can be stored in a LocalDateTime.
This class does not store or represent a time-zone. Instead, it is a description of the date, as used for birthdays, combined with the local time as seen on a wall clock. It cannot represent an instant on the time-line without additional information such as an offset or time-zone.
The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.
Added in 1.8.
Java documentation for java.time.LocalDateTime.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Properties
| Name | Description |
|---|---|
| Class |
Returns the runtime class of this |
| DayOfMonth |
Gets the day-of-month field. |
| DayOfWeek |
Gets the day-of-week field, which is an enum DayOfWeek. |
| DayOfYear |
Gets the day-of-year field. |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| Hour |
Gets the hour-of-day field. |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState | (Inherited from JavaObject) |
| JniPeerMembers | |
| Max | |
| Min | |
| Minute |
Gets the minute-of-hour field. |
| Month |
Gets the month-of-year field using the Month enum. |
| MonthValue |
Gets the month-of-year field from 1 to 12. |
| Nano |
Gets the nano-of-second field. |
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| Second |
Gets the second-of-minute field. |
| ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
| ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
| Year |
Gets the year field. |
Methods
| Name | Description |
|---|---|
| AdjustInto(ITemporal) |
Adjusts the specified temporal object to have the same date and time as this object. |
| AtOffset(ZoneOffset) |
Combines this date-time with an offset to create an OffsetDateTime. |
| AtZone(ZoneId) |
Combines this date-time with a time-zone to create a ZonedDateTime. |
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| CompareTo(IChronoLocalDateTime) |
Compares this date-time to another date-time. |
| CompareTo(Object) | |
| Construct(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DisposeUnlessReferenced() | (Inherited from JavaObject) |
| Equals(Object) | (Inherited from JavaObject) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| Format(DateTimeFormatter) |
Formats this date-time using the specified formatter. |
| From(ITemporalAccessor) |
Obtains an instance of LocalDateTime from a temporal object. |
| Get(ITemporalField) |
Gets the value of the specified field from this date-time as an int. |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| GetLong(ITemporalField) |
Gets the value of the specified field from this date-time as a long. |
| IsAfter(IChronoLocalDateTime) |
Checks if this date-time is after the specified date-time. |
| IsBefore(IChronoLocalDateTime) |
Checks if this date-time is before the specified date-time. |
| IsEqual(IChronoLocalDateTime) |
Checks if this date-time is equal to the specified date-time. |
| IsSupported(ITemporalField) |
Checks if the specified field is supported. |
| IsSupported(ITemporalUnit) |
Checks if the specified unit is supported. |
| JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
| Minus(Int64, ITemporalUnit) |
Returns a copy of this date-time with the specified amount subtracted. |
| Minus(ITemporalAmount) |
Returns a copy of this date-time with the specified amount subtracted. |
| MinusDays(Int64) |
Returns a copy of this LocalDateTime with the specified number of days subtracted. |
| MinusHours(Int64) |
Returns a copy of this LocalDateTime with the specified number of hours subtracted. |
| MinusMinutes(Int64) |
Returns a copy of this LocalDateTime with the specified number of minutes subtracted. |
| MinusMonths(Int64) |
Returns a copy of this LocalDateTime with the specified number of months subtracted. |
| MinusNanos(Int64) |
Returns a copy of this LocalDateTime with the specified number of nanoseconds subtracted. |
| MinusSeconds(Int64) |
Returns a copy of this LocalDateTime with the specified number of seconds subtracted. |
| MinusWeeks(Int64) |
Returns a copy of this LocalDateTime with the specified number of weeks subtracted. |
| MinusYears(Int64) |
Returns a copy of this LocalDateTime with the specified number of years subtracted. |
| Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
| NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
| Now() | |
| Now(Clock) |
Obtains the current date-time from the specified clock. |
| Now(ZoneId) |
Obtains the current date-time from the system clock in the specified time-zone. |
| Of(Int32, Int32, Int32, Int32, Int32, Int32, Int32) |
Obtains an instance of LocalDateTime from year, month, day, hour, minute, second and nanosecond. |
| Of(Int32, Int32, Int32, Int32, Int32, Int32) |
Obtains an instance of LocalDateTime from year, month, day, hour, minute and second, setting the nanosecond to zero. |
| Of(Int32, Int32, Int32, Int32, Int32) |
Obtains an instance of LocalDateTime from year, month, day, hour and minute, setting the second and nanosecond to zero. |
| Of(Int32, Month, Int32, Int32, Int32, Int32, Int32) |
Obtains an instance of LocalDateTime from year, month, day, hour, minute, second and nanosecond. |
| Of(Int32, Month, Int32, Int32, Int32, Int32) |
Obtains an instance of LocalDateTime from year, month, day, hour, minute and second, setting the nanosecond to zero. |
| Of(Int32, Month, Int32, Int32, Int32) |
Obtains an instance of LocalDateTime from year, month, day, hour and minute, setting the second and nanosecond to zero. |
| Of(LocalDate, LocalTime) |
Obtains an instance of LocalDateTime from a date and time. |
| OfEpochSecond(Int64, Int32, ZoneOffset) |
Obtains an instance of LocalDateTime using seconds from the epoch of 1970-01-01T00:00:00Z. |
| OfInstant(Instant, ZoneId) |
Obtains an instance of LocalDateTime from an Instant and zone ID. |
| Parse(ICharSequence, DateTimeFormatter) |
Obtains an instance of LocalDateTime from a text string using a specific formatter. |
| Parse(ICharSequence) |
Obtains an instance of LocalDateTime from a text string such as 2007-12-03T10:15:30. |
| Parse(String, DateTimeFormatter) | |
| Parse(String) | |
| Plus(Int64, ITemporalUnit) |
Returns a copy of this date-time with the specified amount added. |
| Plus(ITemporalAmount) |
Returns a copy of this date-time with the specified amount added. |
| PlusDays(Int64) |
Returns a copy of this LocalDateTime with the specified number of days added. |
| PlusHours(Int64) |
Returns a copy of this LocalDateTime with the specified number of hours added. |
| PlusMinutes(Int64) |
Returns a copy of this LocalDateTime with the specified number of minutes added. |
| PlusMonths(Int64) |
Returns a copy of this LocalDateTime with the specified number of months added. |
| PlusNanos(Int64) |
Returns a copy of this LocalDateTime with the specified number of nanoseconds added. |
| PlusSeconds(Int64) |
Returns a copy of this LocalDateTime with the specified number of seconds added. |
| PlusWeeks(Int64) |
Returns a copy of this LocalDateTime with the specified number of weeks added. |
| PlusYears(Int64) |
Returns a copy of this LocalDateTime with the specified number of years added. |
| Query(ITemporalQuery) |
Queries this date-time using the specified query. |
| Range(ITemporalField) |
Gets the range of valid values for the specified field. |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToLocalDate() |
Gets the LocalDate part of this date-time. |
| ToLocalTime() |
Gets the LocalTime part of this date-time. |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| TruncatedTo(ITemporalUnit) |
Returns a copy of this LocalDateTime with the time truncated. |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| Until(ITemporal, ITemporalUnit) |
Calculates the amount of time until another date-time in terms of the specified unit. |
| Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
| Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| With(ITemporalAdjuster) |
Returns an adjusted copy of this date-time. |
| With(ITemporalField, Int64) |
Returns a copy of this date-time with the specified field set to a new value. |
| WithDayOfMonth(Int32) |
Returns a copy of this LocalDateTime with the day-of-month altered. |
| WithDayOfYear(Int32) |
Returns a copy of this LocalDateTime with the day-of-year altered. |
| WithHour(Int32) |
Returns a copy of this LocalDateTime with the hour-of-day altered. |
| WithMinute(Int32) |
Returns a copy of this LocalDateTime with the minute-of-hour altered. |
| WithMonth(Int32) |
Returns a copy of this LocalDateTime with the month-of-year altered. |
| WithNano(Int32) |
Returns a copy of this LocalDateTime with the nano-of-second altered. |
| WithSecond(Int32) |
Returns a copy of this LocalDateTime with the second-of-minute altered. |
| WithYear(Int32) |
Returns a copy of this LocalDateTime with the year altered. |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IChronoLocalDateTime.AtZone(ZoneId) | |
| IChronoLocalDateTime.Plus(Int64, ITemporalUnit) | |
| IChronoLocalDateTime.ToLocalDate() | |
| IChronoLocalDateTime.With(ITemporalField, Int64) | |
| IJavaPeerable.Disposed() | (Inherited from JavaObject) |
| IJavaPeerable.Finalized() | (Inherited from JavaObject) |
| IJavaPeerable.JniObjectReferenceControlBlock | (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from JavaObject) |
| IJavaPeerable.UnregisterFromRuntime() | |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |