Duration.NormalizeWith(Calendar) 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.
Converts the years and months fields into the days field by using a specific time instant as the reference point.
[Android.Runtime.Register("normalizeWith", "(Ljava/util/Calendar;)Ljavax/xml/datatype/Duration;", "GetNormalizeWith_Ljava_util_Calendar_Handler")]
public abstract Javax.Xml.Datatype.Duration? NormalizeWith (Java.Util.Calendar? startTimeInstant);
[<Android.Runtime.Register("normalizeWith", "(Ljava/util/Calendar;)Ljavax/xml/datatype/Duration;", "GetNormalizeWith_Ljava_util_Calendar_Handler")>]
abstract member NormalizeWith : Java.Util.Calendar -> Javax.Xml.Datatype.Duration
Parameters
- startTimeInstant
- Calendar
Calendar
reference point.
Returns
Duration
of years and months of this Duration
as days.
- Attributes
Exceptions
If the startTimeInstant parameter is null.
Remarks
Converts the years and months fields into the days field by using a specific time instant as the reference point.
For example, duration of one month normalizes to 31 days given the start time instance "July 8th 2003, 17:40:32".
Formally, the computation is done as follows:
<ol> <li>the given Calendar object is cloned</li> <li>the years, months and days fields will be added to the Calendar
object by using the Calendar#add(int,int)
method</li> <li>the difference between the two Calendars in computed in milliseconds and converted to days, if a remainder occurs due to Daylight Savings Time, it is discarded</li> <li>the computed days, along with the hours, minutes and seconds fields of this duration object is used to construct a new Duration object.</li> </ol>
Note that since the Calendar class uses int
to hold the value of year and month, this method may produce an unexpected result if this duration object holds a very large value in the years or months fields.
Java documentation for javax.xml.datatype.Duration.normalizeWith(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.