Last updated on 19 Oct 2019
Bagaimana cara Filter Tanggal di Grid View
Di Grid View:
use kartik\grid\GridView; [ 'attribute' => 'updated_at', 'format' => 'date', 'filterType' => GridView::FILTER_DATE, 'filterWidgetOptions' => [ 'size' => 'xs', 'pluginOptions' => [ 'format' => 'dd-M-yyyy', 'autoWidget' => true, 'autoclose' => true, 'todayHighlight' => true ] ], ],
Di Model Search:
public function rules() { [['page', 'updated_at'], 'safe'] }
Di public function search()
if (!empty($this->updated_at)) { $this->updated_at = date('d-m-Y', strtotime($this->updated_at)); } ->andFilterWhere(['=', 'FROM_UNIXTIME(updated_at, "%d-%m-%Y")', $this->updated_at])