title: Yii Form birthday split in Day Month Year
body: <p>I would separate in the form(view) the birthday of the user in 3 different fields: day, month and year.
  I wonder if I'm doing it right, and if there is an easier way to do this.</p>
  
  <p>Is there a better method in performance? For all find it separates dates, although not necessary.</p>
  
  <hr>
  
  <p>Model.php:</p>
  
  <pre><code>public $birthday_day;
  public $birthday_month;
  public $birthday_year;
  
  ...
  
  public function afterFind() {
      $this-&gt;birthday_day = date('j', strtotime($this-&gt;birthday));
      $this-&gt;birthday_month = date('n', strtotime($this-&gt;birthday));
      $this-&gt;birthday_year = date('Y', strtotime($this-&gt;birthday));
  }
  
  
  public function beforeValidate() {
      if ($this-&gt;birthday_day  AND  $this-&gt;birthday_month  AND  $this-&gt;birthday_year)
          $this-&gt;birthday = new DateTime($birthday_year.'-'$birthday_month'-'.$birthday_day);
  
  }
  </code></pre>