Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to obtain the Julian date Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
16-May-03
Category
Algorithm
Language
Delphi 2.x
Views
86
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

How to obtain the Julian date

Answer:

1   function julian(year, month, day: Integer): real;
2   var
3     yr, mth: Integer;
4     noleap, leap, days, yrs: Real;
5   begin
6     if year < 0 then
7       yr := year + 1
8     else
9       yr := year;
10    mth := month;
11    if (month < 3) then
12    begin
13      mth := mth + 12;
14      yr := yr - 1;
15    end;
16    yrs := 365.25 * yr;
17    if ((yrs < 0) and (frac(yrs) <> 0)) then
18      yrs := int(yrs) - 1
19    else
20      yrs := int(yrs);
21    days := int(yrs) + int(30.6001 * (mth + 1)) + day - 723244.0;
22    if days < -145068.0 then
23      julian := days
24    else
25    begin
26      yrs := yr / 100.0;
27      if ((yrs < 0) and (frac(yrs) <> 0)) then
28        yrs := int(yrs) - 1;
29      noleap := int(yrs);
30      yrs := noleap / 4.0;
31      if ((yrs < 0) and (frac(yrs) <> 0)) then
32        yrs := int(yrs) - 1;
33      leap := 2 - noleap + int(yrs);
34      julian := days + leap;
35    end;
36  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC