# inday - script and chart function

This function returns True if timestamp lies inside the day containing base\_timestamp.

Syntax:

InDay (timestamp, base\_timestamp, period\_no[, day\_start])

**Return data type:** Boolean

Arguments:

InDay arguments

| Argument | Description |
| --- | --- |
| timestamp | The date and time that you want to compare with base\_timestamp. |
| base\_timestamp | Date and time that is used to evaluate the timestamp. |
| period\_no | The day can be offset by period\_no.<br>period\_no is an integer, where the<br>value 0 indicates the day which contains base\_timestamp.<br>Negative values in period\_no indicate<br>preceding days and positive values indicate succeeding days. |
| day\_start | If you want<br>to work with days not starting midnight, indicate an offset as a<br>fraction of a day in day\_start,<br>For example, 0.125 to denote 3 AM. |

Example 1:

`inday ('12/01/2006 12:23:00', '12/01/2006  
 00:00:00', 0)`

Returns True

Example 2:

`inday ('12/01/2006 12:23:00', '13/01/2006 
 00:00:00', 0)`

Returns False

Example 3:

`inday ('12/01/2006 12:23:00', '12/01/2006 
 00:00:00', -1)`

Returns False

Example 4:

`inday ('11/01/2006 12:23:00', '12/01/2006 
 00:00:00', -1)`

Returns True

Example 5:

`inday ('12/01/2006 12:23:00', '12/01/2006 
 00:00:00', 0, 0.5)`

Returns False

Example 6:

`inday ('12/01/2006 11:23:00', '12/01/2006 
 00:00:00', 0, 0.5)`

Returns True

Example 7:

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.

This example checks if an invoice date falls at any time in the day starting with the base\_timestamp.

`TempTable:` `LOAD RecNo() as InvID, * Inline [` `InvTime` `28/03/2012` `10/12/2012` `5/2/2013` `];` ` ` `InvoiceData:` `LOAD *,` `InDay(InvTime, '28/03/2012 00:00:00', 0) AS InDayEx` `Resident TempTable;`

`Drop table TempTable;`

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

Example 7 results

| InvTime | InDayEx |
| --- | --- |
| 28/03/2012 | -1 (True) |
| 10/12/2012 | 0 (False) |
| 5/2/2013 | 0 (False) |