pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Greg Sabino Mullane <greg@turnstep.com>
Cc: pgsql-sql@postgresql.org
Cc: sgnerd@yahoo.com.sg
Subject: Re: Last day of month
Date: Wed, 25 Feb 2004 20:27:57 -0800
Message-ID: <403D75CD.1000109@joeconway.com> (raw)
In-Reply-To: <542c7f6d5ebe4be44d6b3778850f38ff@biglumber.com>
References: <542c7f6d5ebe4be44d6b3778850f38ff@biglumber.com>

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




view thread (6+ messages)  latest in thread

Message-ID: <403D75CD.1000109@joeconway.com>
Permalink:  ../403D75CD.1000109@joeconway.com/
Also on:    postgresql.org/message-id/403D75CD.1000109@joeconway.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mail@joeconway.com, greg@turnstep.com, sgnerd@yahoo.com.sg
  Subject: Re: Last day of month
  In-Reply-To: <403D75CD.1000109@joeconway.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox