1. Home
  2. Computing & Technology
  3. Visual Basic

About 'Real' Julian Dates
Julian dates are more than you think

By Dan Mabbutt, About.com

The Julian calendar has no relation to the Julian date format sometimes used in computing. A Julian date, or day number, is an idea invented by a man named Joseph Scaliger in 1583. Scaliger's original formula is the number of elapsed days since the beginning of a cycle of 7,980 years. This lets you compute a difference between one calendar date and another calendar date back to January 1, 4713 B.C. (Gregorian calendar). Scaliger used a 7,980 year cycle because it was a common multiple of several traditional time cycles (solar, lunar, and a particular Roman tax cycle).

Programmers have a tendency to use the term "Julian Date" to mean any serial date integer from any arbitrary beginning, but usually from the beginning of a particular year.

For example, a "brand X" Visual Basic web site contains this "one line Julian Date function":

Date2Julian = CLng(Format(Year(vDate), "0000") _
+ Format(DateDiff("d", CDate("01/01/" _
+ Format(Year(vDate), "0000")), vDate) _
+ 1, "000"))

It looks sophisticated, but when you run it against the leap day in 2004 (February 29, 2004), you get the number 2004060 which is just the year 2004 concatenated to the serial day - 060. Not a Julian Date. Excel 2003 calculates the astronomical Julian Date as 2415019.5. But then, there are two separate date systems that can be used in Excel (the 1900 and 1904 date systems) that give you different answers due to differences in the ways dates have been handled just in the short history of computing. In programming as in life, Caveat Emptor.

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Using VB.NET
  5. About Calculating Leap Years

©2009 About.com, a part of The New York Times Company.

All rights reserved.