Content tagged “PostgreSQL”

  1. PostgreSQL Quick Tips: Working With Dates Using EXTRACT function

    A handy tip here from Karol Galanciak demonstrating how to use PostgreSQL’s EXTRACT function:

    We can use EXTRACT and now() functions—the former could be used for extracting the current year from a timestamp and the latter could be used for getting the current time.

    Order.where("EXTRACT(year FROM created_at) = EXTRACT(year FROM now())")