Year.Now Method
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.
Overloads
| Name | Description |
|---|---|
| Now() | |
| Now(Clock) |
Obtains the current year from the specified clock. |
| Now(ZoneId) |
Obtains the current year from the system clock in the specified time-zone. |
Now()
[Android.Runtime.Register("now", "()Ljava/time/Year;", "", ApiSince=26)]
public static Java.Time.Year? Now();
[<Android.Runtime.Register("now", "()Ljava/time/Year;", "", ApiSince=26)>]
static member Now : unit -> Java.Time.Year
Returns
- Attributes
Applies to
Now(Clock)
Obtains the current year from the specified clock.
[Android.Runtime.Register("now", "(Ljava/time/Clock;)Ljava/time/Year;", "", ApiSince=26)]
public static Java.Time.Year? Now(Java.Time.Clock? clock);
[<Android.Runtime.Register("now", "(Ljava/time/Clock;)Ljava/time/Year;", "", ApiSince=26)>]
static member Now : Java.Time.Clock -> Java.Time.Year
Parameters
- clock
- Clock
the clock to use, not null
Returns
the current year, not null
- Attributes
Remarks
Obtains the current year from the specified clock. This will query the specified clock to obtain the current year. Using this method allows the use of an alternate clock for testing. The alternate clock may be introduced using dependency injection.
Java reference for java.time.Year.now.
Applies to
Now(ZoneId)
Obtains the current year from the system clock in the specified time-zone.
[Android.Runtime.Register("now", "(Ljava/time/ZoneId;)Ljava/time/Year;", "", ApiSince=26)]
public static Java.Time.Year? Now(Java.Time.ZoneId? zone);
[<Android.Runtime.Register("now", "(Ljava/time/ZoneId;)Ljava/time/Year;", "", ApiSince=26)>]
static member Now : Java.Time.ZoneId -> Java.Time.Year
Parameters
- zone
- ZoneId
the zone ID to use, not null
Returns
the current year using the system clock, not null
- Attributes
Remarks
Obtains the current year from the system clock in the specified time-zone. This will query the system clock to obtain the current year. 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.Year.now.