How would I get the date_trunc by month? Would it be like this?
SELECT date_trunc('month', l_date) month
    FROM this_table
    GROUP BY month
l_date is the column where I would pull the date from.
Yes, that should work just fine in Postgres.
Have you tested it?
If your date is 2014-03-16 10:00:00am:
date_trunc('month', l_date) would give you 2014-03-01 00:00:00 (sets it to first day of truncated month)
date_part('month', l_date) would give you 03 which it looks like that is what you are looking for
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