Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to store Begin and End of Week Period?

Re: How to store Begin and End of Week Period?

From: Brian Peasland <peasland_at_email.msn.com>
Date: Fri, 21 May 1999 13:18:47 -0500
Message-ID: <ef4RXb7o#GA.307@cpmsnbbsa05>


>If you were storing a begin date and end date,
>Would you store it as 05/10/99 - 05/16/1999 or
>would you keep 05/10/99 - 05/16/199 23:59:59?
>
>The second scenerio struck me as odd, but I was
>wondering about a gut feel on this. Any thoughts
>would be appreciated.

I guess that it would depend on how you are using the date ranges. When you store a date, Oracle also stores the time as well. The date and time are not stored seperately. When you do an insert into a table and insert today's date, Oracle assumes that you want the current time stored as well. When you store a date without reading the SYSDATE, Oracle assumes you mean midnight (the start of that date). This is just coming off of memory so I might be wrong about this. Oracle documentation has this pretty well laid out so you can easily verify it. Or test it yourself.

Where this makes a difference is when you are performing operations on two dates (such as the difference betwen the two). The difference between two dates also takes into account the difference between the times stored with the dates. So depending on your application, you might find it best to "force" a time to be stored with the date. That way you won't get unexpected results.

hope this helps,
Brian Peasland
peasland_at_msn.com Received on Fri May 21 1999 - 13:18:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US