### 8.2.2. Durations

Durations are used to calculate a value for end when one is not supplied to in_range operations. They contain the same fields as `date_spec` objects but without the limitations (ie. you can have a duration of 19 days). Like `date_specs`, any field not supplied is ignored.

#### 8.2.2.1. Sample Time Based Expressions

###### Example 8.1. True if now is any time in the year 2005
```
<rule id="rule1">
<date_expression id="date_expr1" start="2005-001" operation="in_range">
<duration years="1"/>
</date_expression>
</rule>

```

###### Example 8.2. Equivalent expression.
```
<rule id="rule2">
<date_expression id="date_expr2" operation="date_spec">
<date_spec years="2005"/>
</date_expression>
</rule>

```

###### Example 8.3. 9am-5pm, Mon-Friday
```
<rule id="rule3">
<date_expression id="date_expr3" operation="date_spec">
<date_spec hours="9-16" days="1-5"/>
</date_expression>
</rule>

```

###### Example 8.4. 9am-6pm, Mon-Friday, or all day saturday
```
<rule id="rule4" boolean_op="or">
<date_expression id="date_expr4-1" operation="date_spec">
<date_spec hours="9-16" days="1-5"/>
</date_expression>
<date_expression id="date_expr4-2" operation="date_spec">
<date_spec days="6"/>
</date_expression>
</rule>

```

###### Example 8.5. 9am-5pm or 9pm-12pm, Mon-Friday
```
<rule id="rule5" boolean_op="and">
<rule id="rule5-nested1" boolean_op="or">
<date_expression id="date_expr5-1" operation="date_spec">
<date_spec hours="9-16"/>
</date_expression>
<date_expression id="date_expr5-2" operation="date_spec">
<date_spec hours="21-23"/>
</date_expression>
</rule>
<date_expression id="date_expr5-3" operation="date_spec">
<date_spec days="1-5"/>
</date_expression>
</rule>

```

###### Example 8.6. Mondays in March 2005
```
<rule id="rule6" boolean_op="and">
<date_expression id="date_expr6-1" operation="date_spec">
<date_spec weekdays="1"/>
</date_expression>
<date_expression id="date_expr6-2" operation="in_range" start="2005-03-01" end="2005-04-01"/>
</rule>

```

NOTE: Because no time is specified, 00:00:00 is implied.
This means that the range includes all of 2005-03-01 but none of 2005-04-01.
You may wish to write end="2005-03-31T23:59:59" to avoid confusion.
###### Example 8.7. A full moon on Friday the 13th
```
<rule id="rule7" boolean_op="and">
<date_expression id="date_expr7" operation="date_spec">
<date_spec weekdays="5" monthdays="13" moon="4"/>
</date_expression>
</rule>

```