Re: LAST_DAY Function in Postgres

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: Amin Schoeib <aschoeib(at)4tek(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: LAST_DAY Function in Postgres
Date: 2003-09-02 13:27:51
Message-ID: Pine.LNX.4.44.0309021522180.17073-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

if didn't find this function on
http://www.postgresql.org/docs/7.3/interactive/functions-datetime.html,
You have to write own function

testdb=> create or replace function last_day(date) returns date as 'select
cast(date_trunc(''month'', $1) + ''1 month''::interval as date) - 1'
language sql;
CREATE FUNCTION
testdb=> select last_day(current_date);
last_day
------------
2003-09-30
(1 řádka)

Bye
Pavel

On Tue, 2 Sep 2003, Amin Schoeib wrote:

> Hi,
> I would like to know if there is a Function in Postgres
> Like the LAST_DAY Function in Oracle??
> In Oracle you can use the function the get the last day of a month.
>
> Thanxx
>
> Schoeib
>
>
> 4Tek Gesellschaft für angewandte Informationstechnologien mbH
> Schoeib Amin
> Tel. +49 (0) 69 697688-132
> Fax. +49 (0) 69 697688-111
> http://www.4tek.de
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2003-09-02 13:29:22 Re: CPAN, P for postgresql [Re: LAST_DAY Function in
Previous Message Shridhar Daithankar 2003-09-02 13:16:59 CPAN, P for postgresql [Re: LAST_DAY Function in Postgres]