LocalDateTime.Now Method

Definition

Overloads

Name Description
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.

Now()

[Android.Runtime.Register("now", "()Ljava/time/LocalDateTime;", "", ApiSince=26)]
public static Java.Time.LocalDateTime? Now();
[<Android.Runtime.Register("now", "()Ljava/time/LocalDateTime;", "", ApiSince=26)>]
static member Now : unit -> Java.Time.LocalDateTime

Returns

Attributes

Applies to

Now(Clock)

Obtains the current date-time from the specified clock.

[Android.Runtime.Register("now", "(Ljava/time/Clock;)Ljava/time/LocalDateTime;", "", ApiSince=26)]
public static Java.Time.LocalDateTime? Now(Java.Time.Clock? clock);
[<Android.Runtime.Register("now", "(Ljava/time/Clock;)Ljava/time/LocalDateTime;", "", ApiSince=26)>]
static member Now : Java.Time.Clock -> Java.Time.LocalDateTime

Parameters

clock
Clock

the clock to use, not null

Returns

the current date-time, not null

Attributes

Remarks

To be added.

Java reference for java.time.LocalDateTime.now.

Applies to

Now(ZoneId)

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

[Android.Runtime.Register("now", "(Ljava/time/ZoneId;)Ljava/time/LocalDateTime;", "", ApiSince=26)]
public static Java.Time.LocalDateTime? Now(Java.Time.ZoneId? zone);
[<Android.Runtime.Register("now", "(Ljava/time/ZoneId;)Ljava/time/LocalDateTime;", "", ApiSince=26)>]
static member Now : Java.Time.ZoneId -> Java.Time.LocalDateTime

Parameters

zone
ZoneId

the zone ID to use, not null

Returns

the current date-time using the system clock, not null

Attributes

Remarks

Obtains the current date-time from the system clock in the specified time-zone. This will query the system clock to obtain the current date-time. 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 reference for java.time.LocalDateTime.now.

Applies to