There is a bug in this Julian to Gregorian Date conversion routine. It converts today 2003:90 to March 31, 2003 to April 00, 2003. Routine follows. Also show that your new routine correctly converts all days of the year.
public int[] julianToGregorianDate(int Year, int Day)
{ double xjdate;
double xjd;
double z;
double fday;
double alpha;
double a, b;
int ic, id, ie;
int day, month, iyear;
xjd=(4715+Year)*365.25+Day-1110;
z = (int)(double)(xjd + 0.5);
fday = xjd + 0.5 - z;
if (fday < 0.0)
{
fday = fday + 1.0;
z = z - 1;
}
if (z < 2299161)
a = z;
else
{
alpha = ((double)(z - 1867216.25) / 36524.25);
a = z + 1.0 + alpha - (int)(double)(alpha / 4.0);
}
b = a + 1524.0;
ic = (int)(double)((b - 122.1) / 365.25);
id = (int)(double)(365.25 * ic);
ie = (int)(double)((b - id) / 30.6001);
day = (int)(double)(b - id - (int)(double) 30.6001 * ie));
if (ie < 14)
month = ie - 1;
else
month = ie - 13;
if (month > 2)
iyear = ic - 4716;
else iyear = Year;
int[] dateP;
dateP = new int[3];
dateP[0] =iyear;
dateP[1] =month;
dateP[2] = day;
return dateP;
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Complete ownership and distribution copyrights to all work purchased.
## Platform
Windows, Linux