|
Loading...
|
derby-user@db.apache.org
[Prev] Thread [Next] | [Prev] Date [Next]
Re: Milisecond support? Rick Hillegas Thu Apr 05 08:05:33 2012
There's an existing doc issue for this problem: https://issues.apache.org/jira/browse/DERBY-5596Regards, -Rick On 4/5/12 7:28 AM, Rick Hillegas wrote:
Hi Libor,The reference manual needs to be corrected. Derby supports 9 nanosecond digits. See the following script output:ij> connect 'jdbc:derby:memory:db;create=true'; ij> create table t( a timestamp ); 0 rows inserted/updated/deleted ij> insert into t( a ) values ( timestamp( '2012-04-05 07:16:19.123' ) ); 1 row inserted/updated/deletedij> insert into t( a ) values ( timestamp( '2012-04-05 07:16:19.123456' ) );1 row inserted/updated/deletedij> insert into t( a ) values ( timestamp( '2012-04-05 07:16:19.123456789' ) );1 row inserted/updated/deleted ij> select * from t; A ----------------------------- 2012-04-05 07:16:19.123 2012-04-05 07:16:19.123456 2012-04-05 07:16:19.123456789 3 rows selected Hope this helps, -Rick On 4/5/12 6:16 AM, Libor Jelinek wrote:Hello all,does Derby TIMESTAMP data type support millisecond? In reference manual (http://db.apache.org/derby/docs/10.8/ref/rrefsqlj27620.html) is stated:/yyy-mm-dd hh:mm:ss[.nnnnnn] yyyy-mm-dd-hh.mm.ss[.nnnnnn]/ /The first of the two formats above is the java.sql.Timestamp format.//The year must always have four digits. Months, days, and hours may have one or two digits. Minutes and seconds must have two digits. *Nanoseconds, if present, may have between one and six digits.*/However because 1 millisecond = 1 000 000 nanoseconds even 1 millisecond can't be stored because it has 7 digis (max is 6)...Also, IMHO because 1 second = 1 000 000 000 nanoseconds, so nanosecond part should have 9 digits, not 6. Also, http://docs.oracle.com/javase/7/docs/api/java/sql/Timestamp.html#setNanos(int) <http://docs.oracle.com/javase/7/docs/api/java/sql/Timestamp.html#setNanos%28int%29> expect that nano part will have max 9 digits.Thanks for your comments. -- Hezky den / Have a nice day Libor JELÍNEK VIRTAGE SOFTWARE // software - design - web Lucni 542 // 285 04 Uhlirske Janovice // Czech Republic support: +420 315 555 488 // cell: +420 777 205 142email/jabber: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> // web: www.virtage.com <http://www.virtage.com>Visit our developer adventures at http://devblog.virtage.com!
- Milisecond support? Libor Jelinek 2012/04/05
- Re: Milisecond support? Rick Hillegas 2012/04/05
- Re: Milisecond support? Rick Hillegas 2012/04/05 <=
- Re: Milisecond support? Libor Jelinek 2012/04/05