pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tony Grant <tony@tgds.net>
To: postgres list <pgsql-general@postgresql.org>
Subject: Re: date format
Date: 03 Apr 2003 07:57:19 +0200
Message-ID: <1049349438.1585.15.camel@vaio> (raw)
In-Reply-To: <Pine.LNX.4.33.0304021555460.18162-100000@css120.ihs.com>
References: <Pine.LNX.4.33.0304021555460.18162-100000@css120.ihs.com>

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




view thread (31+ messages)  latest in thread

Message-ID: <1049349438.1585.15.camel@vaio>
Permalink:  ../1049349438.1585.15.camel@vaio/
Also on:    postgresql.org/message-id/1049349438.1585.15.camel@vaio

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tony@tgds.net
  Subject: Re: date format
  In-Reply-To: <1049349438.1585.15.camel@vaio>
  References: <Pine.LNX.4.33.0304021555460.18162-100000@css120.ihs.com> <1049349438.1585.15.camel@vaio>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox