julian To Excel
Converts serial Julian date into serial Excel date
Controller: CodeCogs
Interface
C++
JulianToExcel
intjulianToExcel( | int | nDate | |
bool | Mac = false | ) |
- 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.
Example 1
#include <stdio.h> #include <codecogs/units/date/juliantoexcel.h> #include <codecogs/units/date/date.h> using namespace Units::Date; int main() { printf("\nIf you type %d into Excel on a Mac, you get valentines day - don't forget!", julianToExcel(date("14 feb 2005"), true)); // 27076 return 0; }
- false: from Window Excel values using 1/1/1900.
- true: from Mac Excel values using 1/1/1904.
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, default for Windows Excel. We can not generate the 29/2/1900 from any Julian values (because it really doesn't exist), however for earlier days we simply subtract one from the Excel values.
Parameters
nDate is the serial number that Excel uses to represent dates. Mac is a switch to identify which base date to use:
Authors
- Will Bateman (Sep 2004)
Source Code
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.