Re: find last day of month

From: Jeffrey Melloy <jmelloy(at)visualdistortion(dot)org>
To: Andrus Moor <eetasoft(at)online(dot)ee>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: find last day of month
Date: 2005-12-08 23:23:20
Message-ID: 4398C068.1050806@visualdistortion.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrus Moor wrote:

>I have a table containing month column in format mm.yyyy
>
>create table months ( tmkuu c(7));
>insert into months values ('01.2005');
>insert into months values ('02.2005');
>
>How to create select statement which converts this column to date type
>containing last day of month like
>
>'2005-01-31'
>'2005-02-28'
>
>Andrus.
>
>
select to_date(tmkuu, 'mm.yyyy') + '1 month'::interval - '1
day'::interval from months; will convert it to a timestamp. You can
further downcast to date if you need to.

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Velevitch 2005-12-09 00:19:01 How efficient is select currval?
Previous Message Edmund 2005-12-08 23:19:33 Re: find last day of month