Re: checking date format with postgresql without creating

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: Neil Zanella <nzanella(at)gpu(dot)srv(dot)ualberta(dot)ca>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: checking date format with postgresql without creating
Date: 2001-11-20 05:54:47
Message-ID: Pine.LNX.4.33L2.0111200253000.18739-100000@aguila.protecne.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 19 Nov 2001, Neil Zanella wrote:

> Hello,
>
> I would like to be able to check whether some date is a valid date by
> asking postgresql? Is this possible?

Sure:

alvherre=> select '28 feb 2001'::date;
date
------------
2001-02-28
(1 row)

alvherre=> select '29 feb 2001'::date;
ERROR: Bad date external representation '29 feb 2001'

You don't need a table to do it.

--
Alvaro Herrera (<alvherre[(at)]atentus(dot)com>)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-11-20 06:22:59 Re: Good configuration?
Previous Message Mike Castle 2001-11-20 05:32:28 email time warps