public static double calculateJulianDay(Date date){
  Calendar cal=Calendar.getInstance(TimeZone.getTimeZone("GMT"));
  cal.setTime(date);
  double hour=cal.get(Calendar.HOUR_OF_DAY) + cal.get(Calendar.MINUTE) / 60.0f + cal.get(Calendar.SECOND) / 3600.0f;
  int year=cal.get(Calendar.YEAR);
  int month=cal.get(Calendar.MONTH) + 1;
  int day=cal.get(Calendar.DAY_OF_MONTH);
  double jd=367.0 * year - Math.floor(7.0 * (year + Math.floor((month + 9.0) / 12.0)) / 4.0) + Math.floor(275.0 * month / 9.0) + day + 1721013.5 + hour / 24.0;
  return jd;
}

public static double calculateJulianDay ( Date date ) { Calendar cal = Calendar . getInstance ( TimeZone . getTimeZone ( "GMT" ) ) ; cal . setTime ( date ) ; double hour = cal . get ( Calendar . HOUR_OF_DAY ) + cal . get ( Calendar . MINUTE ) / 60.0f + cal . get ( Calendar . SECOND ) / 3600.0f ; int year = cal . get ( Calendar . YEAR ) ; int month = cal . get ( Calendar . MONTH ) + 1 ; int day = cal . get ( Calendar . DAY_OF_MONTH ) ; double jd = 367.0 * year - Math . floor ( 7.0 * ( year + Math . floor ( ( month + 9.0 ) / 12.0 ) ) / 4.0 ) + Math . floor ( 275.0 * month / 9.0 ) + day + 1721013.5 + hour / 24.0 ; return jd ; }
calculate the julian day for a given date using the following formula : jd = 367 * y - int ( 7 * ( y + int ( ( m + 9 ) / 12 ) ) / 4 ) + int ( 275 * m / 9 ) + d + 1721013 . 5 + ut / 24 note that this is only valid for the year range 1900 - 2099 .
