programming:Excel:Excel Date/Time internal formatWhat links here?
Internally, Excel uses a floating point number to represent dates and time. The fraction repersents the portion of the day that has passed. For instance, 10:22 (AM) = 0.4319. This is:

10 hours * 60 minutes per hour + 22 minutes / 1440.0 minutes per day.


The date is represented in the the integer part of the number. January 1, 1900 is day 1. So this makes the integer part the number of days past Dec 31, 1899. Except that 1900 was not a leap year, but Excel treats it as if it was "in order to be compatible with other programs". This means dates prior to Mar 1, 1901 are misrepresented.

The following is taken from Microsoft's website:
  1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5.
  2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4.
  3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5.
  4. The year is a leap year (it has 366 days).
  5. The year is not a leap year (it has 365 days).



int days_in_year(int year)
{
    if ((year % 4) != 0) return 365;
    if ((year % 100) != 0) return 366;
    if ((year % 400) != 0) return 365;
    return 366;
}
Time internal format
programming - Pascal
MC6802 - instruction set - Wait For Interrupt
programming - cpp - operator overloading
X Windows Functions - Window XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valuemask, attributes)
programming - HTML - button
programming - C - function fwrite
programming - C - function isspace
Topical Bible - God's Sovereignty
MC6802 - instruction set - Branch if Overflow Set
microprocessors - microchip 16F84A - porta
programming:microchip pics:16F84A status
programming - C - function fseek
Topical Bible - God's Omnipresence
Topical Bible - End Times
programming - C - function fgets
Topical Bible - Giving
Topical Bible - Lot
filename:programming:Excel:Excel Date/Time internal format
filename:programming%3AExcel%3AExcel%20Date%2FTime%20internal%20format
last edit:March 25 2009 19:38:30 (5532 days ago)
ct = 1716066737.000000 = May 18 2024 17:12:17
ft = 1238024310.000000 = March 25 2009 19:38:30
dt = 478042427.000000