Re: Validity check in to_date?

From: "Alexander M(dot) Pravking" <fduch(at)antar(dot)bryansk(dot)ru>
To: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Validity check in to_date?
Date: 2003-12-02 10:30:59
Message-ID: 20031202103059.GG87728@dyatel.antar.bryansk.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, Dec 02, 2003 at 10:27:04AM +0100, Christoph Haller wrote:
> As far as I know these results are correct in terms of the underlying
> C-library function mktime(). This function is intended to be used when
> adding/subtracting intervals from a given timestamp.

Which one? mktime() or to_date()? I'm not sure it's handy to use
to_date() for any calculations, so I'm surprised why doesn't it work
just as date_in() do.

> I don't know of any postgres function doing the check you're looking for.

Yes, the only thing I could think now is to do something like
s/([0-9]+)\.([0-9]+)\.([0-9]+)/\3-\2-\1/ and then pass it to
CAST(... AS date) using ISO DateStyle.

(I could simply use German DateStyle in case of DD.MM.YYYY, but I deal
with several date formats, e.g. DD/MM/YYYY.)

> But I can't believe this is the first time this topic is brought up.
> You may search the archives on "date plausibility" are related terms.

I'm sure too, but it's really hard to find a good keyword sequence when
searching such sort of things :(

Anyway, thank you for attention.

--
Fduch M. Pravking

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Alexander M. Pravking 2003-12-02 10:36:15 Re: Validity check in to_date?
Previous Message Christoph Haller 2003-12-02 10:27:04 Re: Validity check in to_date?