# inmonthtodate - script and chart function

Returns True if timestamp lies inside the part of month containing base\_date up until and including the last millisecond of base\_date.

Syntax:

InMonthToDate (timestamp, base\_date, period\_no)

**Return data type:** Boolean

Arguments:

InMonthToDate arguments

| Argument | Description |
| --- | --- |
| timestamp | The date that you want to compare with base\_date. |
| base\_date | Date that is used to evaluate the month. |
| period\_no | The<br>month can be offset by period\_no.<br>period\_no is<br>an integer, where the value 0 indicates the month which contains base\_date. Negative values in period\_no indicate preceding months and<br>positive values indicate succeeding months. |

Example 1:

`inmonthtodate ('25/01/2013', '25/01/2013', 
 0)`

Returns True

Example 2:

`inmonthtodate ('25/01/2013', '24/01/2013', 
 0)`

Returns False

Example 3:

`inmonthtodate ('25/01/2013', '28/02/2013', 
 -1)`

Returns True

Example 4:

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.

By specifying period\_no as 4, this example checks if an invoice date falls in the fourth month after the month in base\_date but before the end of the day specified in base\_date.

`TempTable:` `LOAD RecNo() as InvID, * Inline [` `InvDate` `28/03/2012` `10/12/2012` `5/2/2013` `31/3/2013` `19/5/2013` `15/9/2013` `11/12/2013` `2/3/2014` `14/5/2014` `13/6/2014` `7/7/2014` `4/8/2014` `];` ` ` `InvoiceData:` `LOAD *,` `InMonthToDate(InvDate, '31/01/2013', 4) AS InMthPlus42D` `Resident TempTable;`

`Drop table TempTable;`

The resulting table contains the original dates and a column with the return value of the inmonthtodate() function.

Example 4 results

| InvDate | InMthPlus42D |
| --- | --- |
| 28/03/2012 | 0 (False) |
| 10/12/2012 | 0 (False) |
| 5/2/2013 | 0 (False) |
| 31/3/2013 | 0 (False) |
| 19/5/2013 | -1 (True) |
| 15/9/2013 | 0 (False) |
| 11/12/2013 | 0 (False) |
| 2/3/2014 | 0 (False) |
| 14/5/2014 | 0 (False) |
| 13/6/2014 | 0 (False) |
| 7/7/2014 | 0 (False) |
| 4/8/2014 | 0 (False) |