Re: date format

From: Tony Grant <tony(at)tgds(dot)net>
To: postgres list <pgsql-general(at)postgresql(dot)org>
Subject: Re: date format
Date: 2003-04-03 05:57:19
Message-ID: 1049349438.1585.15.camel@vaio
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 2003-04-03 at 00:59, scott.marlowe wrote:
> The SQL 92 spec is quite specific that there is an exact order for date
> and it is yyyymmdd period, and that these are constrained by the rules of
> a well formed gregorian calendar (i.e. no 20020231 allowed)
>
> Seeing as how putting in 2002-22-04 and 2002-04-22 on my box results in
> two inputs of april 22nd 2002, it's obvioue postgresql is trying to make
> data fit that should result in a constraint violation.

I can confirm that that inserting dates via JSP + the JDBC driver into
Postgresql does exactly this.

If you want a nice interface that inserts dates in the DD-MM-YYYY format
you will have to write a nice little Javascript function that puts the
date back into the right order before inserting into the database.

SELECT to_char(dateexpofin, 'DD-MM-YYYY') as end, dateexpofin
ORDER BY dateexpofin DESC

will write out the date in "normal" European order and put the latest
date on top of the list.

I was stuck on dates a while back.

Cheers

Tony Grant
--
www.tgds.net Library management software toolkit,
redhat linux on Sony Vaio C1XD,
Dreamweaver MX with Tomcat and PostgreSQL

In response to

  • date format at 2003-04-02 22:59:09 from scott.marlowe

Browse pgsql-general by date

  From Date Subject
Next Message Dennis Gearon 2003-04-03 06:08:46 Re: unable to dump database, toast errors
Previous Message Tom Lane 2003-04-03 05:52:20 Re: unable to dump database, toast errors