儒略日转公历算法

  1. % Gregorian Date from Julian Date 
  2. % This calculation is valid for any Julian Day Number including negative JDN and 
  3. % produces a Gregorian date (or possibly a proleptic Gregorian date)
  4. Z = floor(JD0 - 1721118.5); % JD0 is the Julian Date in propagation 
  5. R = (JD0 - 1721118.5 - Z);  % R is the fractional part of JD0
  6. G = (Z - .25);  
  7. A = (floor(G / 36524.25));  % Calculate the value of A which is the number of full centuries
  8. B = (A - (A / 4)); % The value of B is this number of days minus a constant
  9. year = (floor((B+G) / 365.25)); % Calculate the value of Y, the year in a calendar whose years start on March 1
  10. C = (B + Z - floor(365.25 * year));  % Day count
  11.          month = (fix((5 * C + 456) / 153));  % Month
  12.          UT = (C - fix((153 * month - 457) / 5) + R); % Calculation for UTC
  13.          day = floor(UT);  % Gregorian Day

你可能感兴趣的:(儒略日转公历算法)