src/Utility/Time.php
public static function daysAsSql($begin, $end, $fieldName, $timezone = null) {
		$begin = new CakeTime($begin, $timezone);
		$begin = $begin->format('U');
		$end = new CakeTime($end, $timezone);
		$end = $end->format('U');
		$begin = date('Y-m-d', $begin) . ' 00:00:00';
		$end = date('Y-m-d', $end) . ' 23:59:59';

		return "($fieldName >= '$begin') AND ($fieldName <= '$end')";
	}
public static function daysAsSql($begin, $end, $fieldName, $timezone = null) {
		$begin = new CakeTime($begin, $timezone);
		$begin = $begin->format('U');
		$end = new CakeTime($end, $timezone);
		$end = $end->format('U');
		$begin = date('Y-m-d', $begin) . ' 00:00:00';
		$end = date('Y-m-d', $end) . ' 23:59:59';

		return "($fieldName >= '$begin') AND ($fieldName <= '$end')";
	}
public static function daysAsSql ( $ begin , $ end , $ fieldName , $ timezone = null ) { $ begin = new CakeTime ( $ begin , $ timezone ) ; $ begin = $ begin -> format ( 'U' ) ; $ end = new CakeTime ( $ end , $ timezone ) ; $ end = $ end -> format ( 'U' ) ; $ begin = date ( 'Y-m-d' , $ begin ) . ' 00:00:00' ; $ end = date ( 'Y-m-d' , $ end ) . ' 23:59:59' ; return "($fieldName >= '$begin') AND ($fieldName <= '$end')" ; }
Returns a partial SQL string to search for all records between two dates.

@param int|string|\DateTime $begin UNIX timestamp, strtotime() valid string or DateTime object
@param int|string|\DateTime $end UNIX timestamp, strtotime() valid string or DateTime object
@param string $fieldName Name of database field to compare with
@param string|\DateTimeZone|null $timezone Timezone string or DateTimeZone object
@return string Partial SQL string.
Returns a partial SQL string to search for all records between two dates .