Re: Last day of month

From: Joe Conway <mail(at)joeconway(dot)com>
To: Greg Sabino Mullane <greg(at)turnstep(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, sgnerd(at)yahoo(dot)com(dot)sg
Subject: Re: Last day of month
Date: 2004-02-26 04:27:57
Message-ID: 403D75CD.1000109@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Greg Sabino Mullane wrote:
>>How to find the last sunday/mon..../sat of any given month.
>
> There is probably a smoother way to do it, but here is a
> quick little function to do what you ask. Feed it a date
> and a number, where 0 is Sunday, 1 is Monday, etc.

How about this:

regression=# select date_trunc('month', current_date + '1 month'::interval);
date_trunc
---------------------
2004-03-01 00:00:00
(1 row)

Joe

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Joe Conway 2004-02-26 04:30:46 Re: Last day of month
Previous Message Greg Sabino Mullane 2004-02-26 03:07:52 Re: Last day of month