473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Timestamp via Java

hi all and sorry for my english

I write into a SqlServer2000 database via jdbc using a PreparedStatement
(pstmt) and one of fields is a TimeStamp, my code is:
qwdum=System.currentTimeMillis();
pstmt.setTimestamp(8 , new Timestamp(qwdum));

sometimes the field on table is correct (the milliseconds are the same of
last 3 digits of variable qwdum), other times it has a difference of 1 o 2
milliseconds

the same code with jdbc Oracle or iSeries works fine

any idea?

thanks

Roberto Nenni
Jul 23 '05 #1
1 2566
Your observations are consistent the SQL Server Books Online documentation
regarding the datetime data type:

<Excerpt href="tsqlref.chm::/ts_da-db_9xut.htm">

Date and time data from January 1, 1753 through December 31, 9999, to an
accuracy of one three-hundredth of a second (equivalent to 3.33 milliseconds
or 0.00333 seconds). Values are rounded to increments of .000, .003, or .007
seconds, as shown in the table.

Example Rounded example
01/01/98 23:59:59.999 1998-01-02 00:00:00.000
01/01/98 23:59:59.995,
01/01/98 23:59:59.996,
01/01/98 23:59:59.997, or
01/01/98 23:59:59.998 1998-01-01 23:59:59.997
01/01/98 23:59:59.992,
01/01/98 23:59:59.993,
01/01/98 23:59:59.994 1998-01-01 23:59:59.993
01/01/98 23:59:59.990 or
01/01/98 23:59:59.991 1998-01-01 23:59:59.990

</Excerpt>
--
Hope this helps.

Dan Guzman
SQL Server MVP

"Roberto Nenni" <no****@nospam.net> wrote in message
news:42********************@news.tiscali.it...
hi all and sorry for my english

I write into a SqlServer2000 database via jdbc using a PreparedStatement
(pstmt) and one of fields is a TimeStamp, my code is:
qwdum=System.currentTimeMillis();
pstmt.setTimestamp(8 , new Timestamp(qwdum));

sometimes the field on table is correct (the milliseconds are the same of
last 3 digits of variable qwdum), other times it has a difference of 1 o 2
milliseconds

the same code with jdbc Oracle or iSeries works fine

any idea?

thanks

Roberto Nenni

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil Powell | last post by:
I am forced to have to compare the value of some PHP timestamp with a Java-based java.util.Date.getTime() timestamp. Let me show you how they look: The Java time is returned to the PHP...
4
by: Thomas Mann | last post by:
Hi, how can I make my XSLT-stylesheet insert a timestamp (date/time) into the output file ? Regards Thomas
5
by: Andreas | last post by:
Hi, is there any possibility to get a Timestamp in Java from the DB2-System? (not from a table) Thanks for help. Andreas
2
by: klh | last post by:
I am working with my developer group to switch from the type 2 to the type 4 (Universal Driver). Our set up is: Host Data Base - DB2 z/os v7.1 (mainframe). Client - DB2 Admin Client V8 FP8...
67
by: James Harris | last post by:
I have a requirement to store timestamps in a database. Simple enough you might think but finding a suitably general format is not easy. The specifics are 1) subsecond resolution - milliseconds...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.