home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.sybase
- Path: sparky!uunet!psinntp!jmb2.jmb.com!lewism
- From: lewism@jmb2.jmb.com (Mike Lewis)
- Subject: Why does dateadd() allow milliseconds?
- Message-ID: <1993Jan12.211135.10967@jmb2.jmb.com>
- Organization: JMB Realty Corporation
- X-Newsreader: TIN [version 1.1 PL6]
- Date: Tue, 12 Jan 1993 21:11:35 GMT
- Lines: 23
-
- I just discovered that the datetime data type stores the date and time parts
- separately as 4-byte integers. The 4-byte integer representing time is the
- number of 3/100 of a second since midnight. Therefore, the following equality
- is often (though by no means reliably) true:
-
- iamadatetimevariable = dateadd(ms, 1, iamadatetimevariable)
-
-
- There are 24*60*60*1000= 86,400,000 milliseconds in 24 hours. A signed, 4-byte
- integer should be able to store a number as large as 2,147,483,648. This raises
- two questions in my mind:
-
- 1) What else is Sybase doing with the 4-byte integer representing time?
-
- 2) Why, if the above equality can be true, does Sybase give me the ability
- to add a single ms to a datetime? This ability implies that the above
- equality should never be true and is misleading in the extreme.
-
- Don't get me wrong, this isn't the bug that ate Tokyo or anything. I was
- just wondering why things work this way.
-
-
- Mike Lewis (lewism@jmb2.jmb.com)
-