Why does VBA use 12/30/1899 for zero?
November 13, 2005 9:42 AM   Subscribe

In Microsoft VBA, the zero value for dates is midnight 12/30/1899. Does anyone know why that particular date/time was chosen for zero?
posted by jasper411 to Computers & Internet (7 answers total)
 
Because VB is arbitrary like that.

Oh yeah, and remember those parenthesis when calling functions. (but not subroutines!)
posted by afroblanca at 9:53 AM on November 13, 2005


Best answer: Essentially, zero was supposed to represent the start of the new century.

However, when Microsoft brought out Excel, it needed to be compatible with Lotus 1-2-3. Now, 1-2-3 had a bug regarding the year 1900: it thought that 1900 was a leap year, when in fact it wasn't. To maintain compatibility, the Excel team decided to retain the bug in Excel.

In order not to screw up the dates for the rest of the century, though, they had to shift the zero point back one day. And there you have it.

(See here and here.)
posted by chrismear at 9:53 AM on November 13, 2005


Actually, despite the documentation, if you examine a date with the value zero in Excel, it'll appear to be 'January 0 1900'. Same thing, basically.
posted by chrismear at 9:56 AM on November 13, 2005


Having 0 there makes 1 the first second of the 20th Century - the 1/1/01 00:00:00. From there, date calculations are easy.
posted by benzo8 at 12:13 PM on November 13, 2005


(Until Y2K, of course...)
posted by benzo8 at 12:13 PM on November 13, 2005


chrismear is exactly right. I have several Excel VBA books that tell the same story (why do I have several Excel VBA books to begin with? Um, no reason...).
posted by bingo at 1:16 PM on November 13, 2005


This blog entry by Raymond Chen details a number of these epoch/sentinel timestamps. See also his prior post about the various binary time/datestamp formats found in windows.
posted by Rhomboid at 11:40 PM on November 13, 2005


« Older How old is too old to start over?   |   Is there a way to pull the specific information... Newer »
This thread is closed to new comments.