From 517ad9d4b6eae320b708d03a9340a22893b0cab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 29 Jan 2023 15:45:51 +0100 Subject: New upstream version 4.0.3 --- docs/html/xbc4.html | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 docs/html/xbc4.html (limited to 'docs/html/xbc4.html') diff --git a/docs/html/xbc4.html b/docs/html/xbc4.html new file mode 100755 index 0000000..a0275ed --- /dev/null +++ b/docs/html/xbc4.html @@ -0,0 +1,81 @@ + + +Xbase DBMS Chapter 4 + +

Date Processing

+

Chapter Updated 12/09/22


+ +The objective of this chapter is to provide information regarding +the basic concepts of date arithmetic and supply generic +C/C++ date methods.

+ +

Leap Years

+ +Due to the fact that it actually takes about 365 1/4 days for +the earth to circle the sun, every fourth year and every fourth +century have an extra day added to the end of February and the year +is called a leap year. Leap years have 366 days, non leap years +have 365 days. The following code segment describes how to +determine if a given year is a leap year. + +A leap year is a year having 366 days, which can be evenly +divisible by 4 and not by 100 or divisible by 400. + +There are also leap centuries. Leap centuries are years which +are evenly divisible by 400. + +To calculate a leap year, the following code segment can be used + + + int year; + + if(( year % 4 == 0 && year % 100 != 0 ) || year % 400 = 0 ) + LEAP_YEAR = TRUE; + else + LEAP_YEAR = FALSE + + + +

Julian Dates

+ +Around the time of Jesus Christ, a fellow with the name of Julias Ceasar +established the Julian calendar. The Julian calendar established every +fourth year as a leap year with 366 days and all other years having 365 days. +The months were set up the same as they are with a Gregorian calendar, which +is what we use today. A Julian date is defined as as the number of days from the +first day of the year; February 1 would have a Julian day of 32.

+ +From a programmer's perspective, Julian dates are useful for doing date +arithmetic, determining the difference between two dates or calculating +a future or past date.

+ +To determine the difference between two dates, convert both dates to a +Julian date and subtract one from the other.

+ +To calculate a future or past date, convert the base date to a Julian date, +add (or subtract) the number of days necessary to (from) it and convert the +julian date back to a Gregorian date.

+ +The Julian date routines use a base date of 01/01/0001. DBase julian Dates have an offset of 1721425L, reason unknown. +

+ +

Gregorian Dates

+ +In 1582, Pope Gregor XIII introduced a corrected form of the Julian calendar. +Every 4th year still has 366 days except for century years. Century years +were added as leap years if evenly divisible by 400. The year 2000 is a leap century. +

+ +The methods supplied with this software are based on gregorian dates with +the format of CCYYMMDD for century, year, month and day.

+ + +

Date Formats

+ +All dates are stored in the .DBF files with format CCYYMMDD.

+All date routines work with dates formated with the same CCYYMMDD format.

+ +
+



+ + -- cgit v1.2.3