IsoChronology.DateNow Method

Definition

Overloads

DateNow()

Obtains the current ISO local date from the system clock in the default time-zone.

DateNow(Clock)

Obtains the current ISO local date from the specified clock.

DateNow(ZoneId)

Obtains the current ISO local date from the system clock in the specified time-zone.

DateNow()

Obtains the current ISO local date from the system clock in the default time-zone.

[Android.Runtime.Register("dateNow", "()Ljava/time/LocalDate;", "", ApiSince=26)]
public Java.Time.LocalDate? DateNow ();
[<Android.Runtime.Register("dateNow", "()Ljava/time/LocalDate;", "", ApiSince=26)>]
member this.DateNow : unit -> Java.Time.LocalDate

Returns

the current ISO local date using the system clock and default time-zone, not null

Attributes

Remarks

Obtains the current ISO local date from the system clock in the default time-zone.

This will query the Clock#systemDefaultZone() system clock in the default time-zone to obtain the current date.

Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.

Java documentation for java.time.chrono.IsoChronology.dateNow().

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.

Applies to

DateNow(Clock)

Obtains the current ISO local date from the specified clock.

[Android.Runtime.Register("dateNow", "(Ljava/time/Clock;)Ljava/time/LocalDate;", "", ApiSince=26)]
public Java.Time.LocalDate? DateNow (Java.Time.Clock? clock);
[<Android.Runtime.Register("dateNow", "(Ljava/time/Clock;)Ljava/time/LocalDate;", "", ApiSince=26)>]
member this.DateNow : Java.Time.Clock -> Java.Time.LocalDate

Parameters

clock
Clock

the clock to use, not null

Returns

the current ISO local date, not null

Attributes

Remarks

Obtains the current ISO local date from the specified clock.

This will query the specified clock to obtain the current date - today. Using this method allows the use of an alternate clock for testing. The alternate clock may be introduced using Clock dependency injection.

Java documentation for java.time.chrono.IsoChronology.dateNow(java.time.Clock).

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.

Applies to

DateNow(ZoneId)

Obtains the current ISO local date from the system clock in the specified time-zone.

[Android.Runtime.Register("dateNow", "(Ljava/time/ZoneId;)Ljava/time/LocalDate;", "", ApiSince=26)]
public Java.Time.LocalDate? DateNow (Java.Time.ZoneId? zone);
[<Android.Runtime.Register("dateNow", "(Ljava/time/ZoneId;)Ljava/time/LocalDate;", "", ApiSince=26)>]
member this.DateNow : Java.Time.ZoneId -> Java.Time.LocalDate

Parameters

zone
ZoneId

Returns

the current ISO local date using the system clock, not null

Attributes

Remarks

Obtains the current ISO local date from the system clock in the specified time-zone.

This will query the Clock#system(ZoneId) system clock to obtain the current date. Specifying the time-zone avoids dependence on the default time-zone.

Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.

Java documentation for java.time.chrono.IsoChronology.dateNow(java.time.ZoneId).

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.

Applies to