---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, PMD Scripting, Scripts]
nav: wcp_docs
parent_url: /wcp_docs/
title: between (date2, precision)
layout: subsection
---

## <a id="section_m3p_myb_5db"></a>Description

Returns the number of precision units between the 2 date objects.

## <a id="section_cyq_j1m_zsb"></a>Return Type

`int`

## <a id="section_dz5_pwg_5db"></a>Instance Method Syntax

```
thisDate1.between(date2, precision)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>date2</td><td>The second date in a date range. <p><b>Note:</b> The input Date instance is the first date in the date range.</p></td></tr><tr><td>precision</td><td>The unit of measure for the comparison. Valid values (case-sensitive): <ul><li>YEAR
</li><li>MONTH
</li><li>DAY
</li><li>HOUR
</li><li>MINUTE
</li><li>SECOND
</li><li>MILLISECOND
</li></ul></td></tr></tbody></table><br/>

<b>Example</b>

Assume <i>dateWidget1.value</i> is 03/01/2022, and <i>dateWidget2.value</i> is 03/30/2022.

`dateWidget1.value.between(dateWidget2.value, 'DAY')`

Returns `29`.

## <a id="section_njs_xzl_zsb"></a>Namespace Function Syntax

```
date:between(date1, date2, precision)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>date1</td><td>The first date in a date range. The Date object is typically the value of a <code>date</code> tag.</td></tr><tr><td>date2</td><td>The second date in a date range.</td></tr><tr><td>precision</td><td>The unit of measure for the comparison. Valid values (case-sensitive): <ul><li>YEAR
</li><li>MONTH
</li><li>DAY
</li><li>HOUR
</li><li>MINUTE
</li><li>SECOND
</li><li>MILLISECOND
</li></ul></td></tr></tbody></table><br/>

