#### ForEach

##### ForEachDay(Datetime a)

This function returns the Date portion of a specified DateTime value.

Parameter

a - A DateTime value.

Return value

The return value is a Date.

Example

If the DateTime is Dec.25,1999 20:12:50, the return value of the following statement is 12/25/99.

`ForEachDay(ToDateTime(1999, 12, 25, 20, 12, 50))`

##### ForEachWeek(DateTime a)

This function returns the Date of the first day of the week.

Parameter

a - A DateTime value.

Return value

The return value is a Date.

Example

If the DateTime is Oct. 15,1999 5:15:20 and it is Friday, the return value of the following statement is 10/10/99.

`ForEachWeek(ToDateTime(1999, 10, 15, 5, 15, 20))`

##### ForEachHalfMonth(DateTime a)

If the day in the DateTime is less than 15, this function will return to the first day of the month. If the day is more than 15, it will return to the 16th day of the month.

Parameter

a - A DateTime value.

Return value

The return value is a date.

Examples

- If the datetime is Sep.13,1999 12:27:15, the return value of the following statement is 09/01/99.

  `ForEachHalfMonth(ToDateTime(1999,9,13,12,27,15))`

- If the datetime is Oct.18,1999 5:21:22, the return value of the following statement is 10/16/99.

  `ForEachHalfMonth(ToDateTime(1999,10,18,5,21,22))`

##### ForEachMonth(DateTime a)

This function returns the first day of the month in a specified DateTime value.

Parameter

a - A DateTime value.

Return value

The return value is a date.

Example

If the datetime is Sep.24,1999 12:05:56, the return value of the following statement is 09/01/99.

`ForEachMonth(ToDateTime(1999,9,24,12,5,56))`

##### ForEachQuarter(DateTime a)

If the month of a specified DateTime is before April, the function will return to Jan. 1 of the year. If the month is after April but before July, the function will return to April. 1 of the year. If the month is after July but before October, the function will return to July. 1 of the year. If the month is after October, the function will return to Oct.1 of the year.

Parameter

a - A DateTime value.

Return value

The return value is a date.

Examples

- If the datetime is Feb.14,1997 2:10:23, the return value of the following statement is 01/01/97.

  `ForEachQuarter(ToDateTime(1997,2,14,2,10,23))`

- If the datetime is May. 28,1999 10:10:25, the return value of the following statement is 04/01/99.

  `ForEachQuarter(ToDateTime(1999,5,28,10,10,25))`

- If the datetime is Aug. 28,1999 10:10:25, the return value of the following statement is 07/01/99.

  `ForEachQuarter(ToDateTime(1999,8,28,10,10,25))`

- If the datetime is Nov. 11,1998 11:40:23, the return value of the following statement is 10/01/98.

  `ForEachQuarter(ToDateTime(1998,11,11,11,40,23))`

##### ForEachHalfYear(DateTime a)

If the month of a specified DateTime is before July, the function will return to Jan.1 of the year. Otherwise the function will return to July 1 of the year.

Parameter

a - A DateTime value.

Return value

The return value is a date.

Examples:

- If the datetime is May. 28,1999 10:10:25, the return value of the following statement is 01/01/99.

  `ForEachHalfYear(ToDateTime(1999, 5, 28, 10, 10, 25))`

- If the datetime is Nov. 15,1998 11:40:23, the return value of the following statement is 07/01/99.

  `ForEachHalfYear(ToDateTime(1998, 11, 15, 11, 40, 23))`

##### ForEachYear(DateTime a)

This function will return to Jan.1 of the year.

Parameter

a - A DateTime value.

Return value

The return value is a date.

Example

If the datetime is Aug. 28,1999 10:10:25, the return value of the following statement is 01/01/99.

`ForEachYear(ToDateTime(1999, 8, 28, 10, 10, 25))`