How can I select rows from the table that are in certain date range with knex queries? For example, selecting rows from last seven days.
Knex version: 0.15.0
DB: PostgreSQL
Any way you choose to query them should do, here is one way to do it:
knex('table')
.where('createdAt', '>=', '2009-01-01T00:00:00Z')
.where('createdAt', '<', '2010-01-01T00:00:00Z')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With