postgresql - How to calculate end of the month in Postgres? -


how calculate end of month in postgres? have table column date datatype. want calculate end of month of every date. eg. in table there values "2015-07-10 17:52:51","2015-05-30 11:30:19" end of month should 31 july 2015,31 may 2015. please guide me in this.

how truncating beginning of month, jumping forward 1 month, 1 day?

myapp_co_development=#  select (date_trunc('month', now()) + interval '1 month - 1 day')::date; date ------------  2015-07-31 (1 row) 

change now() date variable. can manipulate output (with strftime, etc.) format need.

source


Comments