How to get current month firstdate and lastdate in postgres sql query
Asked Answered
M

1

5

I want to get first and last dates of current month (Like 30th or 31st).How to get this one by using postgress sql query.

Malisamalison answered 14/4, 2017 at 7:30 Comment(1)
You should flag this and migrate to Database AdministratorsOvertax
O
18

First day is easy...

SELECT date_trunc('month', CURRENT_DATE);

Last day isn't much more difficult either.

SELECT date_trunc('month', CURRENT_DATE) + interval '1 month - 1 day';
Overtax answered 14/4, 2017 at 7:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.