DatatypeFactory.NewDurationYearMonth 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
NewDurationYearMonth(Boolean, Int32, Int32) |
Create a |
NewDurationYearMonth(Boolean, BigInteger, BigInteger) |
Create a |
NewDurationYearMonth(String) |
Create a |
NewDurationYearMonth(Int64) |
Create a |
NewDurationYearMonth(Boolean, Int32, Int32)
Create a Duration
of type xdt:yearMonthDuration
using the specified
year
and month
as defined in
XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.
[Android.Runtime.Register("newDurationYearMonth", "(ZII)Ljavax/xml/datatype/Duration;", "GetNewDurationYearMonth_ZIIHandler")]
public virtual Javax.Xml.Datatype.Duration? NewDurationYearMonth (bool isPositive, int year, int month);
[<Android.Runtime.Register("newDurationYearMonth", "(ZII)Ljavax/xml/datatype/Duration;", "GetNewDurationYearMonth_ZIIHandler")>]
abstract member NewDurationYearMonth : bool * int * int -> Javax.Xml.Datatype.Duration
override this.NewDurationYearMonth : bool * 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.
- year
- Int32
Year of Duration
.
- month
- Int32
Month of Duration
.
Returns
New Duration
created using the specified year
and month
.
- Attributes
Exceptions
If any values would create an invalid Duration
.
Remarks
Create a Duration
of type xdt:yearMonthDuration
using the specified year
and month
as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.
A DatatypeConstants#FIELD_UNDEFINED
value indicates that field is not set.
Java documentation for javax.xml.datatype.DatatypeFactory.newDurationYearMonth(boolean, int, int)
.
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
NewDurationYearMonth(Boolean, BigInteger, BigInteger)
Create a Duration
of type xdt:yearMonthDuration
using the specified
year
and month
as defined in
XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.
[Android.Runtime.Register("newDurationYearMonth", "(ZLjava/math/BigInteger;Ljava/math/BigInteger;)Ljavax/xml/datatype/Duration;", "GetNewDurationYearMonth_ZLjava_math_BigInteger_Ljava_math_BigInteger_Handler")]
public virtual Javax.Xml.Datatype.Duration? NewDurationYearMonth (bool isPositive, Java.Math.BigInteger? year, Java.Math.BigInteger? month);
[<Android.Runtime.Register("newDurationYearMonth", "(ZLjava/math/BigInteger;Ljava/math/BigInteger;)Ljavax/xml/datatype/Duration;", "GetNewDurationYearMonth_ZLjava_math_BigInteger_Ljava_math_BigInteger_Handler")>]
abstract member NewDurationYearMonth : bool * Java.Math.BigInteger * Java.Math.BigInteger -> Javax.Xml.Datatype.Duration
override this.NewDurationYearMonth : bool * Java.Math.BigInteger * Java.Math.BigInteger -> 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.
- year
- BigInteger
Year of Duration
.
- month
- BigInteger
Month of Duration
.
Returns
New Duration
created using the specified year
and month
.
- Attributes
Exceptions
If any values would create an invalid Duration
.
If implementation cannot support requested values.
Remarks
Create a Duration
of type xdt:yearMonthDuration
using the specified year
and month
as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.
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
NewDurationYearMonth(String)
Create a Duration
of type xdt:yearMonthDuration
by parsing its String
representation,
"<em>PnYnM</em>",
XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.
[Android.Runtime.Register("newDurationYearMonth", "(Ljava/lang/String;)Ljavax/xml/datatype/Duration;", "GetNewDurationYearMonth_Ljava_lang_String_Handler")]
public virtual Javax.Xml.Datatype.Duration? NewDurationYearMonth (string? lexicalRepresentation);
[<Android.Runtime.Register("newDurationYearMonth", "(Ljava/lang/String;)Ljavax/xml/datatype/Duration;", "GetNewDurationYearMonth_Ljava_lang_String_Handler")>]
abstract member NewDurationYearMonth : string -> Javax.Xml.Datatype.Duration
override this.NewDurationYearMonth : string -> Javax.Xml.Datatype.Duration
Parameters
- lexicalRepresentation
- String
Lexical representation of a duration.
Returns
New Duration
created using the specified lexicalRepresentation
.
- Attributes
Exceptions
If the lexicalRepresentation
does not conform to the specification.
If implementation cannot support requested values.
If lexicalRepresentation
is null
.
Remarks
Create a Duration
of type xdt:yearMonthDuration
by parsing its String
representation, "<em>PnYnM</em>", XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.
The datatype xdt:yearMonthDuration
is a subtype of xs:duration
whose lexical representation contains only year and month components. This datatype resides in the namespace javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI
.
Both 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.newDurationYearMonth(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
NewDurationYearMonth(Int64)
Create a Duration
of type xdt:yearMonthDuration
using the specified milliseconds as defined in
XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.
[Android.Runtime.Register("newDurationYearMonth", "(J)Ljavax/xml/datatype/Duration;", "GetNewDurationYearMonth_JHandler")]
public virtual Javax.Xml.Datatype.Duration? NewDurationYearMonth (long durationInMilliseconds);
[<Android.Runtime.Register("newDurationYearMonth", "(J)Ljavax/xml/datatype/Duration;", "GetNewDurationYearMonth_JHandler")>]
abstract member NewDurationYearMonth : int64 -> Javax.Xml.Datatype.Duration
override this.NewDurationYearMonth : int64 -> Javax.Xml.Datatype.Duration
Parameters
- durationInMilliseconds
- Int64
Milliseconds of Duration
to create.
Returns
New Duration
created using the specified durationInMilliseconds
.
- Attributes
Remarks
Create a Duration
of type xdt:yearMonthDuration
using the specified milliseconds as defined in XQuery 1.0 and XPath 2.0 Data Model, xdt:yearMonthDuration.
The datatype xdt:yearMonthDuration
is a subtype of xs:duration
whose lexical representation contains only year and month components. This datatype resides in the namespace javax.xml.XMLConstants#W3C_XPATH_DATATYPE_NS_URI
.
Both 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()
can be influenced.
Any remaining milliseconds after determining the year and month are discarded.
Java documentation for javax.xml.datatype.DatatypeFactory.newDurationYearMonth(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.