Custom Date Validation.

Hello everyone, iam triying to do a custom date validation where i assing an appointment and if this appointment is lower than the current date cant write "1" in my attribute Realizada.

This is the code i been triying but i cant make it work:


  public function cita($attribute,$params)

	{

	if($this->Realizada=='1' && ($this->FechaCita < date('Y-m-d H:i:s')))

	$this->addError($attribute,"Aun no se a llegado a la fecha de la cita.");

	}

Hope someone can help me to do it in the correct way.

Try this




public function cita($attribute,$params)

{

    if($this->Realizada=='1' && (strtotime($this->FechaCita) < time()))

        $this->addError($attribute,"Aun no se a llegado a la fecha de la cita.");

}