convert Julian date to Gregorian date

S

Sam

How do I convert Julian Date to Calendar Date in ASP.Net 1.1 based on
following guideline found at Internet?

To convert Julian date to Gregorian date:

double JD = 2299160.5;

double Z = Math.Floor(JD+0.5);
double W = Math.Floor((Z - 1867216.25)/36524.25);
double X = Math.Floor(W/4);
double AA = Math.Floor(Z+1+W-X);
double BB = Math.Floor(AA+1524);
double CC = Math.Floor((BB-122.1)/365.25);
double DD = Math.Floor(365.25*CC);
double EE = Math.Floor((BB-DD)/30.6001);
double FF = Math.Floor(30.6001*EE);

double Day = BB-DD-FF;
double Month;
double Year;

if((EE-13) <= 12 && (EE-13) > 0)
Month = EE-13;
else
Month = EE-1;

if(Month == 1 || Month == 2)
Year = CC-4715;
else
Year = CC-4716;
 
P

Pete Davis

I'm not sure what you're asking. I mean, this is pretty much the code for
it. I'd be surprised if you couldn't just copy and paste this into a C#
method and be done with it.

Simply pass "JD" as a parameter to the method and return Month Day and Year
as a DateTime, string, or whatever.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top