there is such a request
SELECT name_film, date( from_unixtime( created_at ) ) created_at FROM `fl_films` ORDER BY created_at Is it possible to make it in ActiveRecord?
there is such a request
SELECT name_film, date( from_unixtime( created_at ) ) created_at FROM `fl_films` ORDER BY created_at Is it possible to make it in ActiveRecord?
Create a class, for example:
class Films extends \yii\db\ActiveRecord { public static function tableName() { return 'fl_films'; } } And then generate a query to the database, for example:
$customers = Films::find() ->select(['name_film', 'date(from_unixtime(created_at)) created_at']) ->orderBy('created_at') ->all(); date(from_unixtime(created_at)) unfortunately only gives 2016 more correct:
Films::find() ->select(['name_film', 'date_format(from_unixtime(created_at),"%d%m%Y") created_at']) ->orderBy('created_at') ->all(); Source: https://ru.stackoverflow.com/questions/522595/
All Articles