SQL — JUL() Function
Syntax
JUL(year,month,day)
Description
The JUL() function returns the Julian day number for a given date. The
year may be an actual year such as 1998, or it may be a small number such
as 98, which will be interpreted to mean 1998. As a default, the function,
JUL(0,0,0), will return the Julian value for the current date. Note that
00 as the year number is considered to be 1900, not 2000.
The number 1721426 equals January 1, 1 (AD). If a smaller number is used,
BBx will assume this is a zero or a BC date, and an !ERROR=41 Integer
or range error is produced.
A Julian date is defined as the number of days passed since January 1,
4713 BC (By definition, a Julian date changes at noon.) Because the days
are sequentially numbered, it is a convenient way to determine the number
of days between any two dates.
The JUL() function should work for any date from about the 1800s until
approximately the year 4000 (past the end of the Julian cycle). The problem
with early Julian dates is caused by leap years. For centuries, every
fourth year was considered a leap year. Advances in the knowledge of astronomy,
however, led to revisions in the leap year definition. These revisions
placed existing calendars behind by several weeks. To allow calendars
to "catch up," two weeks had to be skipped. This correction
was performed at different times by different countries between the 16th
and 18th centuries. These early dates are considered to be unimportant;
early calendars are assumed to be correct. Any date after the year 1752
should be reasonably standard on any calendar.
Note: Some popular worksheets erroneously consider 1900 to be a leap year.
Example
Select DATE(jul(0,0,0)) as Today, last_name from customer