they are exactly that. the fields are DATE type in the database
Main Topics
Browse All TopicsI have one problem left with my sql when calculating a time difference. Assume EndDate = 03/31/2009 02:00:47 and BeginDate is 03/31/2009 02:00:46. I should get 1 second. I am getting 00:00:00. Everything above 1 second works just great. This is what I'm using:
TO_CHAR(TO_DATE(TRUNC(MOD(
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Its because of the order of your arithmetic. Oracle subtracts 2 date values and returns a floating point value that represents days. enddate - begindate for 1 second different is really: .00001157
You then are converting it to seconds, but as a floating point value, you get rounding errors, and its less than thje integer 1 (actually 0.999 something), so when passing that to TO_DATE( ..., 'SSSSS') Oracle isn't going to round UP, its just goint to give you the "SECOND" component, which is 0.
Instead, convert the values into seconds _before_ doing the arithmetic on them.
Business Accounts
Answer for Membership
by: angelIIIPosted on 2009-04-02 at 16:15:06ID: 24055512
question: are the date/time values you showed for enddate and begindate really exactly that, or do they eventually have some milliseconds?