Calcula la cantidad de unidades de tiempo entre dos fechas.
Se debe especificar una de las siguientes unidades de tiempo:
La expresión periodlength también debe especificar si la fecha de finalización del periodo es inclusive o exclusive o la fecha de finalización (el periodo es siempre incluyendo la fecha de inicio).
El cálculo de la duración del periodo siempre se redondea al entero más cercan inferior.
<?xml version="1.0" encoding="UTF-8"?> <RuleSet name="Example_periodlength" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "http://www.curamsoftware.com/CreoleRulesSchema.xsd"> <Class name="PeriodLengthExampleClass"> <!-- NB 1970 no era un año bisiesto --> <Attribute name="firstDayOfJanuary1970"> <type> <javaclass name="curam.util.type.Date"/> </type> <derivation> <Date value="1970-01-01"/> </derivation> </Attribute> <Attribute name="lastDayOfDecember1970"> <type> <javaclass name="curam.util.type.Date"/> </type> <derivation> <Date value="1970-12-31"/> </derivation> </Attribute> <Attribute name="firstDayOfJanuary1971"> <type> <javaclass name="curam.util.type.Date"/> </type> <derivation> <Date value="1971-01-01"/> </derivation> </Attribute> <Attribute name="sameDay_LengthInDays"> <type> <javaclass name="Number"/> </type> <derivation> <!-- se inicia y finaliza el mismo día = 1 día --> <periodlength endDateInclusion="inclusive" unit="days"> <reference attribute="firstDayOfJanuary1970"/> <reference attribute="firstDayOfJanuary1970"/> </periodlength> </derivation> </Attribute> <Attribute name="sameDay_LengthInWeeks"> <type> <javaclass name="Number"/> </type> <derivation> <!-- se inicia y finaliza el mismo día = 0 semanas--> <periodlength endDateInclusion="exclusive" unit="weeks"> <reference attribute="firstDayOfJanuary1970"/> <reference attribute="firstDayOfJanuary1970"/> </periodlength> </derivation> </Attribute> <Attribute name="januaryToDecember_LengthInDays"> <type> <javaclass name="Number"/> </type> <derivation> <!-- 365 days --> <periodlength endDateInclusion="inclusive" unit="days"> <reference attribute="firstDayOfJanuary1970"/> <reference attribute="lastDayOfDecember1970"/> </periodlength> </derivation> </Attribute> <Attribute name="januaryToDecember_LengthInYearsExclusive"> <type> <javaclass name="Number"/> </type> <derivation> <!-- 0 años (casi 1 año, pero sólo 1 día escasamente) --> <periodlength endDateInclusion="exclusive" unit="years"> <reference attribute="firstDayOfJanuary1970"/> <reference attribute="lastDayOfDecember1970"/> </periodlength> </derivation> </Attribute> <Attribute name="januaryToDecember_LengthInYearsInclusive"> <type> <javaclass name="Number"/> </type> <derivation> <!-- 1 year (exactly) --> <periodlength endDateInclusion="inclusive" unit="years"> <reference attribute="firstDayOfJanuary1970"/> <reference attribute="lastDayOfDecember1970"/> </periodlength> </derivation> </Attribute> <Attribute name="januaryToJanuary_LengthInYearsExclusive"> <type> <javaclass name="Number"/> </type> <derivation> <!-- 1 year (exactly) --> <periodlength endDateInclusion="exclusive" unit="years"> <reference attribute="firstDayOfJanuary1970"/> <reference attribute="firstDayOfJanuary1971"/> </periodlength> </derivation> </Attribute> </Class> </RuleSet>