title: How to format date from database in Yii2
body: <p>If I have function like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>protected function getAreaValues($model)
   {
    return 
    [
     [
      $model-&gt;getAttributeLabel('EXPDATE'),TbArea::findOne($model-&gt;KODE)-&gt;EXPDATE
     ], 
  
    ];
   }</code></pre>
  </div>
  </div>
  </p>
  
  <p>where EXPDATE IS date data</p>
  
  <p>How to format it in d-M-Y ?</p>
  
  <p>I add formatter in web.php in config like this</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  'formatter' =&gt; [
     'class' =&gt; 'yii\i18n\Formatter',
     'nullDisplay' =&gt; '-',
     'dateFormat' =&gt; 'd-M-Y',
     'datetimeFormat' =&gt; 'd-M-Y H:i:s',
     'timeFormat' =&gt; 'H:i:s',   
    ],</code></pre>
  </div>
  </div>
  </p>
  
  <p>But still not working</p>