Udostępnij za pośrednictwem


Duration.GetTimeInMillis Method

Definition

Overloads

GetTimeInMillis(Calendar)

Returns the length of the duration in milliseconds.

GetTimeInMillis(Date)

Returns the length of the duration in milliseconds.

GetTimeInMillis(Calendar)

Returns the length of the duration in milliseconds.

[Android.Runtime.Register("getTimeInMillis", "(Ljava/util/Calendar;)J", "GetGetTimeInMillis_Ljava_util_Calendar_Handler")]
public virtual long GetTimeInMillis (Java.Util.Calendar? startInstant);
[<Android.Runtime.Register("getTimeInMillis", "(Ljava/util/Calendar;)J", "GetGetTimeInMillis_Ljava_util_Calendar_Handler")>]
abstract member GetTimeInMillis : Java.Util.Calendar -> int64
override this.GetTimeInMillis : Java.Util.Calendar -> int64

Parameters

startInstant
Calendar

The length of a month/year varies. The startInstant is used to disambiguate this variance. Specifically, this method returns the difference between startInstant and startInstant+duration

Returns

milliseconds between startInstant and startInstant plus this Duration

Attributes

Exceptions

if startInstant parameter is null.

Remarks

Returns the length of the duration in milliseconds.

If the seconds field carries more digits than millisecond order, those will be simply discarded (or in other words, rounded to zero.) For example, for any Calendar value x,

<code>new Duration("PT10.00099S").getTimeInMills(x) == 10000</code>.
<code>new Duration("-PT10.00099S").getTimeInMills(x) == -10000</code>.

Note that this method uses the #addTo(Calendar) method, which may work incorrectly with Duration objects with very large values in its fields. See the #addTo(Calendar) method for details.

Java documentation for javax.xml.datatype.Duration.getTimeInMillis(java.util.Calendar).

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

GetTimeInMillis(Date)

Returns the length of the duration in milliseconds.

[Android.Runtime.Register("getTimeInMillis", "(Ljava/util/Date;)J", "GetGetTimeInMillis_Ljava_util_Date_Handler")]
public virtual long GetTimeInMillis (Java.Util.Date? startInstant);
[<Android.Runtime.Register("getTimeInMillis", "(Ljava/util/Date;)J", "GetGetTimeInMillis_Ljava_util_Date_Handler")>]
abstract member GetTimeInMillis : Java.Util.Date -> int64
override this.GetTimeInMillis : Java.Util.Date -> int64

Parameters

startInstant
Date

The length of a month/year varies. The startInstant is used to disambiguate this variance. Specifically, this method returns the difference between startInstant and startInstant+duration.

Returns

milliseconds between startInstant and startInstant plus this Duration

Attributes

Exceptions

If the startInstant parameter is null.

Remarks

Returns the length of the duration in milliseconds.

If the seconds field carries more digits than millisecond order, those will be simply discarded (or in other words, rounded to zero.) For example, for any Date value x,

<code>new Duration("PT10.00099S").getTimeInMills(x) == 10000</code>.
<code>new Duration("-PT10.00099S").getTimeInMills(x) == -10000</code>.

Note that this method uses the #addTo(Date) method, which may work incorrectly with Duration objects with very large values in its fields. See the #addTo(Date) method for details.

Java documentation for javax.xml.datatype.Duration.getTimeInMillis(java.util.Date).

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.

See also

Applies to