Hi i have function where i need to take values from dropdownlist(in 3 dropdownlists i have year, month, day like in facebook registration). I want to set date from this 3 values.
public function setDate()
{
$month=$this->month+1;
$date = date_create();
date_date_set($date, $this->year,$month, $this->day);
return date_format($date, 'Y-m-d');
}
then in my controller i want to save my date but it doesnt work.
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$model->setDate();
$model->save();
Which method of date can i use to this operation where i can give my values in parameters?
i try this method too
public function setDate()
{
$month=$this->month+1;
$date = new DateTime();
$date ->setDate($this->year,$month, $this->day);
return $date->format('Y-m-d');
}
but i have
Argument 1 passed to Faker\Provider\Base::__construct() must be an instance of Faker\Generator, none given, called in E:\htdocs\mesport\frontend\modules\settings\models\Profile.php on line 119 and defined