Is there a EOMONTH() equivalent in Postgresql? If not, how do I select only the last day of the month for any given month and any given year given a time stamp? For example, I have a dataset with timestamps. From those times, I want to select only 2015-01-31, 2015-02-28, ... 2016-02-29, 2016-03-31, etc. What is an efficient way to do that?
One method is:
select date_trunc('month', col) + interval '1 month' - interval '1 day'
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