Wednesday, May 5, 2010

Gregorian date to Julian date in C#

Hey there...

Since we generat Reports from DB2 used by JDE, we need to convert Gregorian date to julian date when we write SQL queries... searched a lot for this option on web. Thought this should be helpful to lot of people who is looking for it...

int intJulianDate = 1000 * (DateTime.Now.Year - 1900) + DateTime.Now.DayOfYear;

Console.WriteLine(intJulianDate.ToString());

Hope it helpz
Fauzi - 4Z


1 comment:

Anonymous said...

works like magic, thx very much