I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
this unit 1.40
sub units 0.00

excel To Julian

Converts serial Excel date into serial Julian date
Controller: CodeCogs




boolMac = false )
This function converts the serial numbers that Excel use to represent dates, into a serial Julian number, which is standard adopted by the CodeCogs library. It is the exact opposite of julianToExcel.

Excel only understands the Gregorian date system, but for added confusion Microsoft have chosen to present dates differently under the Windows and Apple OSX operating systems (though you can change this default behaviour):
  • the Windows standard: starts on the 1 January 1900, which is represented by 1.
  • the Mac standard (Apple's OSX): starts on 1 January 1904, which is represented by 0.

On a Windows platform the calculation to get the serial Julian date is:

On a Mac (OSX) you add an extra 365*4 + 1

Example 1

#include <stdio.h>
#include <codecogs/units/date/exceltojulian.h>
#include <codecogs/units/date/dateymd.h>
using namespace Units::Date;
int main()
    for(int i=5555;i<5560;i++)
      int y,m,d;
      printf("\nWindows Excel use %d to represent %d-%d-%d",i, d,m,y);
  return 0;
Windows Excel use 5555 to represent 17-3-1915
Windows Excel use 5556 to represent 18-3-1915
Windows Excel use 5557 to represent 19-3-1915
Windows Excel use 5558 to represent 20-3-1915
Windows Excel use 5559 to represent 21-3-1915

  • false: to Window Excel values using 1/1/1900.
  • true: to Mac Excel values using 1/1/1904.


Unfortunately Microsoft made a mistake, so they think 29/2/1900 exists - but 1900 isn't a leap year!! This clearly only has an impact in the 1900 date system, standard on Windows Excel. Therefore to handle this error, we simply assume an Excel value of 60 to correspond to 1/3/1900. While values below 60 are incremented by 1.


ExcelDateis the serial number that Excel uses to represent dates.
Macis a switch to identify which base date to use:


Will Bateman (Sep 2004)
Source Code

