<?php
class dateCalculation {
public $use_date;
function __construct($date=null) {
if(!empty($date)) {
$this->use_date = $date;
} else {
$this->use_date = date('Y-m-d H:i:s');
}
}
public function nextValidDrawDate() {
$next_valid_date_time_1 = strtotime('this wednesday 20:00');
$next_valid_date_time_2 = strtotime('this saturday 20:00');
if(strtotime($this->use_date) > $next_valid_date_time_1) {
// Past wednesday 20:00 of this week.
$appointment_date_time = $next_valid_date_time_1;
} else {
$appointment_date_time = $next_valid_date_time_2;
}
echo date('Y-m-d H:i', $appointment_date_time);
}
}
echo date('Y-m-d H:i:s');
$dateCalculation = new dateCalculation();
echo $dateCalculation->nextValidDrawDate();
- Output for 5.6.28, 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- 2015-09-18 19:45:132015-09-19 20:00
- Output for 7.3.32 - 7.3.33, 8.0.13
- 2015-09-18 17:45:132015-09-19 20:00
- Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.23, 7.0.0 - 7.0.8
- 2015-09-18 19:45:122015-09-19 20:00
preferences:
198.58 ms | 402 KiB | 291 Q