public function actionIndex()
 {
     $model = new DynamicModel(['created_at' => time()]);
     $model->attachBehavior('format', ['class' => DateConverter::className(), 'logicalFormat' => 'php:d/m/Y', 'physicalFormat' => 'php:time', 'attributes' => ['createAt' => 'created_at']]);
     var_dump($model->createAt);
     $model->createAt = '10/59/2015';
     var_dump($model->created_at);
     print_r([$model->created_at, time()]);
     echo str_repeat('=', '5');
     $model->created_at = time();
     print_r([$model->createAt, $model->created_at]);
     die(__METHOD__);
     // return $this->render('index');
 }
Beispiel #2
0
 public function behaviors()
 {
     return [['class' => DateConverter::className(), 'type' => 'date', 'logicalFormat' => 'php:d-m-Y', 'attributes' => ['FrDate' => 'fr_date', 'ToDate' => 'to_date', 'SDate' => 'sdate']]];
 }