DatatypeFactory.NewDuration 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
NewDuration(Int64) |
Obtain a new instance of a |
NewDuration(String) |
Obtain a new instance of a |
NewDuration(Boolean, BigInteger, BigInteger, BigInteger, BigInteger, BigInteger, BigDecimal) |
Obtain a new instance of a |
NewDuration(Boolean, Int32, Int32, Int32, Int32, Int32, Int32) |
Obtain a new instance of a |
NewDuration(Int64)
Obtain a new instance of a Duration
specifying the Duration
as milliseconds.
[Android.Runtime.Register("newDuration", "(J)Ljavax/xml/datatype/Duration;", "GetNewDuration_JHandler")]
public abstract Javax.Xml.Datatype.Duration? NewDuration (long durationInMilliSeconds);
[<Android.Runtime.Register("newDuration", "(J)Ljavax/xml/datatype/Duration;", "GetNewDuration_JHandler")>]
abstract member NewDuration : int64 -> Javax.Xml.Datatype.Duration
Parameters
- durationInMilliSeconds
- Int64
Duration in milliseconds to create.
Returns
New Duration
representing durationInMilliSeconds
.
- Attributes
Remarks
Obtain a new instance of a Duration
specifying the Duration
as milliseconds.
XML Schema Part 2: Datatypes, 3.2.6 duration, defines duration
as:
<blockquote> duration represents a duration of time. The value space of duration is a six-dimensional space where the coordinates designate the Gregorian year, month, day, hour, minute, and second components defined in Section 5.5.3.2 of [ISO 8601], respectively. These components are ordered in their significance by their order of appearance i.e. as year, month, day, hour, minute, and second. </blockquote>
All six values are set by computing their values from the specified milliseconds and are available using the get
methods of the created Duration
. The values conform to and are defined by:
<ul> <li>ISO 8601:2000(E) Section 5.5.3.2 Alternative format</li> <li> W3C XML Schema 1.0 Part 2, Appendix D, ISO 8601 Date and Time Formats</li> <li>XMLGregorianCalendar
Date/Time Datatype Field Mapping Between XML Schema 1.0 and Java Representation</li> </ul>
The default start instance is defined by GregorianCalendar
's use of the start of the epoch: i.e., java.util.Calendar#YEAR
= 1970, java.util.Calendar#MONTH
= java.util.Calendar#JANUARY
, java.util.Calendar#DATE
= 1, etc. This is important as there are variations in the Gregorian Calendar, e.g. leap years have different days in the month = java.util.Calendar#FEBRUARY
so the result of Duration#getMonths()
and Duration#getDays()
can be influenced.
Java documentation for javax.xml.datatype.DatatypeFactory.newDuration(long)
.
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
NewDuration(String)
Obtain a new instance of a Duration
specifying the Duration
as its string representation, "PnYnMnDTnHnMnS",
as defined in XML Schema 1.
[Android.Runtime.Register("newDuration", "(Ljava/lang/String;)Ljavax/xml/datatype/Duration;", "GetNewDuration_Ljava_lang_String_Handler")]
public abstract Javax.Xml.Datatype.Duration? NewDuration (string? lexicalRepresentation);
[<Android.Runtime.Register("newDuration", "(Ljava/lang/String;)Ljavax/xml/datatype/Duration;", "GetNewDuration_Ljava_lang_String_Handler")>]
abstract member NewDuration : string -> Javax.Xml.Datatype.Duration
Parameters
- lexicalRepresentation
- String
String
representation of a Duration
.
Returns
New Duration
created from parsing the lexicalRepresentation
.
- Attributes
Exceptions
If lexicalRepresentation
is not a valid representation of a Duration
.
If implementation cannot support requested values.
if lexicalRepresentation
is null
.
Remarks
Obtain a new instance of a Duration
specifying the Duration
as its string representation, "PnYnMnDTnHnMnS", as defined in XML Schema 1.0 section 3.2.6.1.
XML Schema Part 2: Datatypes, 3.2.6 duration, defines duration
as:
<blockquote> duration represents a duration of time. The value space of duration is a six-dimensional space where the coordinates designate the Gregorian year, month, day, hour, minute, and second components defined in Section 5.5.3.2 of [ISO 8601], respectively. These components are ordered in their significance by their order of appearance i.e. as year, month, day, hour, minute, and second. </blockquote>
All six values are set and available from the created Duration
The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException
will be thrown with a message indicating implementation limits if implementation capacities are exceeded.
Java documentation for javax.xml.datatype.DatatypeFactory.newDuration(java.lang.String)
.
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
NewDuration(Boolean, BigInteger, BigInteger, BigInteger, BigInteger, BigInteger, BigDecimal)
Obtain a new instance of a Duration
specifying the Duration
as isPositive, years, months, days, hours, minutes, seconds.
[Android.Runtime.Register("newDuration", "(ZLjava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigDecimal;)Ljavax/xml/datatype/Duration;", "GetNewDuration_ZLjava_math_BigInteger_Ljava_math_BigInteger_Ljava_math_BigInteger_Ljava_math_BigInteger_Ljava_math_BigInteger_Ljava_math_BigDecimal_Handler")]
public abstract Javax.Xml.Datatype.Duration? NewDuration (bool isPositive, Java.Math.BigInteger? years, Java.Math.BigInteger? months, Java.Math.BigInteger? days, Java.Math.BigInteger? hours, Java.Math.BigInteger? minutes, Java.Math.BigDecimal? seconds);
[<Android.Runtime.Register("newDuration", "(ZLjava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigInteger;Ljava/math/BigDecimal;)Ljavax/xml/datatype/Duration;", "GetNewDuration_ZLjava_math_BigInteger_Ljava_math_BigInteger_Ljava_math_BigInteger_Ljava_math_BigInteger_Ljava_math_BigInteger_Ljava_math_BigDecimal_Handler")>]
abstract member NewDuration : bool * Java.Math.BigInteger * Java.Math.BigInteger * Java.Math.BigInteger * Java.Math.BigInteger * Java.Math.BigInteger * Java.Math.BigDecimal -> Javax.Xml.Datatype.Duration
Parameters
- isPositive
- Boolean
Set to false
to create a negative duration. When the length
of the duration is zero, this parameter will be ignored.
- years
- BigInteger
of this Duration
- months
- BigInteger
of this Duration
- days
- BigInteger
of this Duration
- hours
- BigInteger
of this Duration
- minutes
- BigInteger
of this Duration
- seconds
- BigDecimal
of this Duration
Returns
New Duration
created from the specified values.
- Attributes
Exceptions
If values are not a valid representation of a Duration
.
If implementation cannot support requested values.
Remarks
Obtain a new instance of a Duration
specifying the Duration
as isPositive, years, months, days, hours, minutes, seconds.
The XML Schema specification states that values can be of an arbitrary size. Implementations may chose not to or be incapable of supporting arbitrarily large and/or small values. An UnsupportedOperationException
will be thrown with a message indicating implementation limits if implementation capacities are exceeded.
A null
value indicates that field is not set.
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
NewDuration(Boolean, Int32, Int32, Int32, Int32, Int32, Int32)
Obtain a new instance of a Duration
specifying the Duration
as isPositive, years, months, days, hours, minutes, seconds.
[Android.Runtime.Register("newDuration", "(ZIIIIII)Ljavax/xml/datatype/Duration;", "GetNewDuration_ZIIIIIIHandler")]
public virtual Javax.Xml.Datatype.Duration? NewDuration (bool isPositive, int years, int months, int days, int hours, int minutes, int seconds);
[<Android.Runtime.Register("newDuration", "(ZIIIIII)Ljavax/xml/datatype/Duration;", "GetNewDuration_ZIIIIIIHandler")>]
abstract member NewDuration : bool * int * int * int * int * int * int -> Javax.Xml.Datatype.Duration
override this.NewDuration : bool * int * int * int * int * int * int -> Javax.Xml.Datatype.Duration
Parameters
- isPositive
- Boolean
Set to false
to create a negative duration. When the length
of the duration is zero, this parameter will be ignored.
- years
- Int32
of this Duration
- months
- Int32
of this Duration
- days
- Int32
of this Duration
- hours
- Int32
of this Duration
- minutes
- Int32
of this Duration
- seconds
- Int32
of this Duration
Returns
New Duration
created from the specified values.
- Attributes
Exceptions
If values are not a valid representation of a Duration
.
Remarks
Obtain a new instance of a Duration
specifying the Duration
as isPositive, years, months, days, hours, minutes, seconds.
A DatatypeConstants#FIELD_UNDEFINED
value indicates that field is not set.
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
- <xref:Javax.Xml.Datatype.DatatypeFactory.NewDuration(System.Boolean%2c+Java.Math.BigInteger%2c+Java.Math.BigInteger%2c+Java.Math.BigInteger%2c+Java.Math.BigInteger%2c+Java.Math.BigInteger%2c+Java.Math.BigInteger)>