Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > convert Julian date to Gregorian date

Reply
Thread Tools

convert Julian date to Gregorian date

 
 
Sam
Guest
Posts: n/a
 
      04-27-2005
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;


 
Reply With Quote
 
 
 
 
Pete Davis
Guest
Posts: n/a
 
      04-27-2005
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

"Sam" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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;
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GetDayOfYear JulianCalendar System.globalization producing wrong julian date??? jason@cyberpine.com ASP .Net 2 08-13-2006 02:24 PM
How can I convert a Julian (1970) time value to a standard date an =?Utf-8?B?SmFjaw==?= Microsoft Certification 1 07-25-2006 10:14 AM
Gregorian to Julian Date conversion =?Utf-8?B?Q2hyaXMgRGF2b2xp?= ASP .Net 3 02-03-2005 06:51 PM
Convert Julian Date to VB.NET date =?Utf-8?B?UmFqYQ==?= ASP .Net 1 11-12-2004 06:08 PM
convert gregorian date to jalay date h_ghanaty ASP .Net 1 11-09-2003 06:02 AM



Advertisments