CodeCogs - An iteractive open source Numerical library Welcome... Login
CodeCogs
shopping cart
OSXWindowsLinux
Search CodeCogs
Numerical Components

Valid RSS

UnitsDate

excel To Julian

Available under GPL (Free) and Commercial licence
get a GPL licence
COST (GBP)
this unit 1.17
sub units 0.00
add a commercial licence to your cart
0
viewed 1624 times and licensed 14 times

Converts serial Excel date into serial Julian date

Controller: CodeCogs  Contact Controller
+View version details
Contents hide toc
buy now     get GPL     add to cart

Interface

#include <codecogs/units/date/exceltojulian.h>

using namespace Units::Date;

int excelToJulian (int ExcelDate, bool Mac=false)
Converts serial Excel date into serial Julian date
ExcelInteger cc_excelToJulian (Integer ExcelDate, Boolean Mac)
This function is available as a Microsoft Excel add-in.

Function Documentation

Excel To Julian Calculator
  
Add calculator to website or email
 
intexcelToJulianintExcelDate
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):

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

nDate = ExcelDate + 2415020

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; dateYMD(excelToJulian(i),y,m,d); printf("\nWindows Excel use %d to represent %d-%d-%d",i, d,m,y); } return 0; }
Output:
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

Note:
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.
Parameters:
ExcelDateis the serial number that Excel uses to represent dates.
Macis a switch to identify which base date to use:
Authors:
Will Bateman (Sep 2004)
Source Code:

To view or download source code you need either a GPL or Commercial Licence.

buy now     get GPL     add to cart

Not a member, then Register with CodeCogs. Already a Member, then Login.


Page Comments

Format Excel Equations

  You must login to leave a messge


Last Modified: 18 Oct 07 @ 17:07     Page Rendered: 2010-03-13 00:26:52

Valid CSS!   Valid XHTML 1.0 Transitional