i want check if date isn't greater today. write code isn't work:
public function getdate() { $month = $this->month; return $this->year . '-' . $month . '-' . $this->day; } public function getdbformateddate() { if (checkdate($this->month, $this->day, $this->year) || $this->strtotime(getdate())>strtotime(date("y-m-d"))){ $datedeadline = date_create($this->getdate()); $this->birthdate = date_format($datedeadline, 'y-m-d'); yii::$app->session->setflash('success', yii::t('app', 'zmiany w profilu zostaĆy zapisane')); } else { yii::$app->getsession()->setflash('error', 'nie ma takeij daty'); } }
use curdate() + interval 2 day
select * `table` date > curdate() + interval 2 day
this should trick!
Comments
Post a Comment