Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 53822 invoked from network); 19 Nov 2006 23:30:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Nov 2006 23:30:17 -0000 Received: (qmail 12261 invoked by uid 500); 19 Nov 2006 23:30:26 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 11862 invoked by uid 500); 19 Nov 2006 23:30:26 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 11851 invoked by uid 99); 19 Nov 2006 23:30:25 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Nov 2006 15:30:25 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [65.32.5.135] (HELO ms-smtp-05.tampabay.rr.com) (65.32.5.135) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Nov 2006 15:30:12 -0800 Received: from matkins (153.75.118.70.cfl.res.rr.com [70.118.75.153]) by ms-smtp-05.tampabay.rr.com (8.13.6/8.13.6) with ESMTP id kAJNTomN019382 for ; Sun, 19 Nov 2006 18:29:50 -0500 (EST) From: "Marl Atkins" To: "'Derby Discussion'" Subject: RE: Date - Timestamp format for inserts? Date: Sun, 19 Nov 2006 18:30:28 -0500 Message-ID: <0bd401c70c32$b2d96c00$6401a8c0@matkins> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Thread-Index: AccMIlzgUytyOkebTiqR7qN2v9xWpAAEEinA In-Reply-To: <20061119212545.GA14666@localhost.localdomain> X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Checked: Checked by ClamAV on apache.org A DATE field won't let me record the time will it? -----Original Message----- From: Bernt.Johnsen@Sun.COM [mailto:Bernt.Johnsen@Sun.COM] Sent: Sunday, November 19, 2006 4:26 PM To: Derby Discussion Subject: Re: Date - Timestamp format for inserts? >>>>>>>>>>>> Bryan Pendleton wrote (2006-11-19 11:53:16): > >What's wrong with this statement? > > Although the doc in > http://db.apache.org/derby/docs/dev/ref/rrefsqlj27620.html > appears to say that the minutes and seconds portions of the timestamp > value can be ommitted, the code does not appear to conform to that > behavior. > > So instead of '2006-09-10-00', use '2006-09-10-00.00.00' or > '2006-09-10 00:00:00'. > > Hopefully that will be a reasonable solution to your problem for now. > > From what I see by reading through > SQLTimestamp.parseDateOrTimestamp(), the code intends for the minutes > and seconds portions to be optional, but the implementation doesn't > handle that, so my initial reaction is that the documentation is > correct and this is a bug in the timestamp parser. > > What do others think? Is Derby supposed to accept '2006-09-10-00' as a > valid timestamp value? I would definitely say no. The correct syntax is '2006-09-10 00:00:00'. I think that we should stick to the SQL spec and JDBC spec which again is built upon ISO 8601 (An ok summary is found here http://www.cl.cam.ac.uk/~mgk25/iso-time.html) Dates should the use "-" as a separator and times should use ":" and "." between seconds and fractions of seconds. SQL and JDBC uses " " as a separator between date and time in timestamp while ISO 8601 specifies "T", so it would be an idea to let Derby accept both '2006-09-10 00:00:00' and '2006-09-10T00:00:00'. All applications built on top of JDBC should, however ise JDBC's escape syntax for maximum portabiliety: {ts '2006-09-10 00:00:00'} BTW: Why use TIMESTAMP for a date column? Wouldn't DATE be more appropriate? -- Bernt Marius Johnsen, Database Technology Group, Staff Engineer, Technical Lead Derby/Java DB Sun Microsystems, Trondheim, Norway