.NET Framework Bookmark and Share   
 index > .NET Base Class Library > transform DateTime into Julian day
 

transform DateTime into Julian day

hello how can i transform DateTime into Julian day?
Marius Fanu
H. _冬_ Tony

Here's code that will do it.

Code Block

long DateToJulian(DateTime dt)

{

return DateToJulian(dt.Year, dt.Month, dt.Day);

}

long DateToJulian(int y, int m, int d)

{

return (1461 * (y + 4800 + (m - 14) / 12)) / 4 +

(367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 -

(3 * ((y + 4900 + (m - 14) / 12) / 100)) / 4 +

d - 32075;

}

Chris Eargle
H. _冬_ Tony

Here's code that will do it.

Code Block

long DateToJulian(DateTime dt)

{

return DateToJulian(dt.Year, dt.Month, dt.Day);

}

long DateToJulian(int y, int m, int d)

{

return (1461 * (y + 4800 + (m - 14) / 12)) / 4 +

(367 * (m - 2 - 12 * ((m - 14) / 12))) / 12 -

(3 * ((y + 4900 + (m - 14) / 12) / 100)) / 4 +

d - 32075;

}

Chris Eargle

You can use google to search for other answers

Custom Search

More Threads

• Reflection Question
• Directory.Copy
• Printing a Web Browser Control from inside a Windows Service
• List.RemoveAt(int index) returns void??
• Format Problem
• Accessing System.Management from Guest user account
• Access Denied when logging to text file
• Generate C# Destructor using CodeDOM
• Is it possible to hide select enumeration values from intellisense?
• .NET MIDI support?