mysql - How to perform a query that contains DATE_FORMAT syntax with PHP PicoDb query builder?

one text

Solution:

Try to build query this ways if its giving you exact what you want.

$db->table('tasks')->subquery('DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP()- date_moved), ‘%d’)', 'Age')->buildSelectQuery();

Then you should try with executing query like this.

$db->table('tasks')->subquery('DATE_FORMAT(FROM_UNIXTIME(UNIX_TIMESTAMP()- date_moved), ‘%d’)', 'Age')->eq('project_id', 42)->asc('Age')->findAll()

Source