B
B
BonBon Slick2017-08-02 14:50:50
PostgreSQL
BonBon Slick, 2017-08-02 14:50:50

SQL curdate() in Postgres?

In MySQL:

$records = DB::table('users')->select(DB::raw('*'))
                  ->whereRaw('Date(created_at) = CURDATE()')->get();
    dd($records );

In PostgreSQL, either the first or the second options do not work, it gives an error that the function is unknown.
$records = DB::table('users')->select(DB::raw('*'))
                  ->whereRaw('Date(created_at) = CURRENT_DATE()')->get();
    dd($records );

https://www.postgresql.org/docs/9.6/static/functio...
So how do you apply the function and pull the posts for today?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gill-sama, 2017-08-02
@BonBonSlick

parentheses are not needed!
look more closely.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question