Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Convert(Duration) |
Converts the given time duration to this unit. |
Convert(Int64, TimeUnit) |
Converts the given time duration in the given unit to this unit. |
Converts the given time duration to this unit.
[Android.Runtime.Register("convert", "(Ljava/time/Duration;)J", "", ApiSince=33)]
public long Convert(Java.Time.Duration? duration);
[<Android.Runtime.Register("convert", "(Ljava/time/Duration;)J", "", ApiSince=33)>]
member this.Convert : Java.Time.Duration -> int64
the time duration
the converted duration in this unit,
or Long.MIN_VALUE
if conversion would negatively overflow,
or Long.MAX_VALUE
if it would positively overflow.
Converts the given time duration to this unit.
For any TimeUnit unit
, unit.convert(Duration.ofNanos(n))
is equivalent to unit.convert(n, NANOSECONDS)
, and unit.convert(Duration.of(n, unit.toChronoUnit()))
is equivalent to n
(in the absence of overflow).
Added in 11.
Java documentation for java.util.concurrent.TimeUnit.convert(java.time.Duration)
.
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.
Product | Versions |
---|---|
.NET for Android | .NET for Android API 34, .NET for Android API 35, .NET for Android API 36 |
Converts the given time duration in the given unit to this unit.
[Android.Runtime.Register("convert", "(JLjava/util/concurrent/TimeUnit;)J", "")]
public long Convert(long sourceDuration, Java.Util.Concurrent.TimeUnit? sourceUnit);
[<Android.Runtime.Register("convert", "(JLjava/util/concurrent/TimeUnit;)J", "")>]
member this.Convert : int64 * Java.Util.Concurrent.TimeUnit -> int64
the time duration in the given sourceUnit
the unit of the sourceDuration
argument
the converted duration in this unit,
or Long.MIN_VALUE
if conversion would negatively overflow,
or Long.MAX_VALUE
if it would positively overflow.
Converts the given time duration in the given unit to this unit. Conversions from finer to coarser granularities truncate, so lose precision. For example, converting 999
milliseconds to seconds results in 0
. Conversions from coarser to finer granularities with arguments that would numerically overflow saturate to Long.MIN_VALUE
if negative or Long.MAX_VALUE
if positive.
For example, to convert 10 minutes to milliseconds, use: TimeUnit.MILLISECONDS.convert(10L, TimeUnit.MINUTES)
Java documentation for java.util.concurrent.TimeUnit.convert(long, java.util.concurrent.TimeUnit)
.
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.
Product | Versions |
---|---|
.NET for Android | .NET for Android API 34, .NET for Android API 35, .NET for Android API 36 |
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in