Re: Problem with to_date/to_char

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Amin Schoeib <aschoeib(at)4tek(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem with to_date/to_char
Date: 2003-09-05 10:38:52
Message-ID: 20030905103852.GA15335@zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Sep 05, 2003 at 11:26:05AM +0200, Amin Schoeib wrote:
> Hi,
> Can somebody tell me why this query don't work when I use to_date
> Instead of to_char
>
> By using to_char:
>
> select
> to_char(last_day(cast(current_date - interval '1 month' as date)),'DD.MM.YYYY')
> ;
>
> Result: 31.08.2003
>
> By using to_date:
>
> select
> to_date(last_day(cast(current_date - interval '1 month' as date)),'DD.MM.YYYY')
> ;

to_date() do conversion from 'string' to 'data' .... see docs.

Karel

--
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
http://home.zf.jcu.cz/~zakkr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Csaba Nagy 2003-09-05 10:46:02 Re: Replaceing records
Previous Message Sergey Suleymanov 2003-09-05 10:11:29 default EXECUTE privilege