2 ms·
In Ruby, using Sequel: DB[:cars].where { insurance_end_date < Time.now }.count (replacing "Time.now" with Sequel.function("NOW") if you want server side,
by vidarh 8y ago
In Ruby, using Sequel:
DB[:cars].where { insurance_end_date < Time.now }.count
(replacing "Time.now" with Sequel.function("NOW") if you want server side, or whatever date/time formatting function you want that'll return time/date in your desired format client side; client side it'll be evaluated once)
I think most ORMs can do a reasonable job at this in languages where you have sufficient flexibility in overloading behaviour.