Хорошо у меня есть сценарий (это разбивается)дата между не работает, если дата охватывает несколько лет
$monday = date('m/d/y',strtotime('this week monday'));
$this_monday = date('y-m-d',strtotime('this week monday'));
$tuesday = date('m/d/y',strtotime('this week tuesday'));
$this_tuesday = date('y-m-d',strtotime('this week tuesday'));
$wednesday = date('m/d/y',strtotime('this week wednesday'));
$this_wednesday = date('y-m-d',strtotime('this week wednesday'));
$thursday = date('m/d/y',strtotime('this week thursday'));
$this_thursday = date('y-m-d',strtotime('this week thursday'));
$friday = date('m/d/y',strtotime('this week friday'));
$this_friday = date('y-m-d',strtotime('this week friday'));
$saturday = date('m/d/y',strtotime('this week saturday'));
$this_saturday = date('y-m-d',strtotime('this week saturday'));
$sunday = date('m/d/y',strtotime('this week sunday'));
$this_sunday = date('y-m-d',strtotime('this week sunday'));
$fourth_monday = date('m/d/y',strtotime($this_monday.'+21 days'));
$fourth_tuesday = date('m/d/y',strtotime($this_tuesday.'+21 days'));
$fourth_wednesday = date('m/d/y',strtotime($this_wednesday.'+21 days'));
$fourth_thursday = date('m/d/y',strtotime($this_thursday.'+21 days'));
$fourth_friday = date('m/d/y',strtotime($this_friday.'+21 days'));
$fourth_saturday = date('m/d/y',strtotime($this_saturday.'+21 days'));
$fourth_sunday = date('m/d/y',strtotime($this_sunday.'+21 days'));
$fourthSchedule = DB::getInstance()->getAssoc("SELECT * FROM sched WHERE full_name = ? AND date between ? and ?", array(
$tech, $fourth_monday, $fourth_sunday));
foreach($fourthSchedule->results() as $results) {
$sched_rows_4[$tech][] = $results;
}
Это прекрасно работает, если он остается в текущем году. Проблема в том, что если на этой неделе (как и в этом году), она пройдет с конца декабря до начала января, она не вернет результаты.
Любое понимание было бы полезно оценить, как исправить эту проблему.
Ваш 'date' поле в базе данных' date' типа? –
Это не его varchar – nickmc01