There are plenty of resources showing how to calculate zenith and azimuth of the Sun when the time and the location are given.

However, I need to calculate the location where the sun is at the zenith for a given time and date, not the other way around. Is there a more or less easy way to do this calculation?


1 Answer 1


Okey, I found a solution - it's actually pretty simple:

  • Latitude is the declination of the sun
  • Longitude is the right ascension minus GMST (Greenwich Mean Sidereal Time)

Sample Code for Java: (The equations are from here (german))

private static double dateToJulianDate(Date date) {
    return date.getTime() / dayMs - 0.5 + J1970;

public static HashMap<String, Double> sunPos(Date date)
    double J = dateToJulianDate(date);
    double T = (J - J2000)/36525d;
    double M = 2*Math.PI * (0.993133 + 99.997361 * T );
    double L = 2*Math.PI * (0.7859453 + M/(2*Math.PI) + (6893.0*Math.sin(M)+72.0*Math.sin(2.0*M)+6191.2*T) / 1296000d);
    double e = 2*Math.PI * (23.43929111 + (-46.8150*T - 0.00059*T*T + 0.001813*T*T*T)/3600.0d)/360d;
    double DK = Math.asin(Math.sin(e)*Math.sin(L));
    double RA = Math.atan(Math.tan(L)*Math.cos(e));
    double GMST = Math.abs(getSiderealTime(J,0)%(2*Math.PI));

    if(RA < 0) RA      = RA + Math.PI;
    if(L > Math.PI) RA = RA + Math.PI;

    double lat = DK*57.2957795;
    double lon = (RA - GMST)*57.2957795;

    HashMap<String, Double> ret = new HashMap<String, Double>();

    return ret;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.