Calculate solar noon for this date var solNoonGMT = calcSolNoonUTC(T, longitude); var solNoonLST = solNoonGMT - (60 * zone) + daySavings; var solnStr = timeString(solNoonLST); var utcSolnStr = timeString(solNoonGMT); riseSetForm["solnoon"].value = solnStr; riseSetForm["utcsolnoon"].value = utcSolnStr; //***********Convert lat and long to standard format convLatLong(latLongForm); // report special cases of no sunrise if(nosunrise) { riseSetForm["utcsunrise"].value = ""; // if Northern hemisphere and spring or summer, OR // if Southern hemisphere and fall or winter, use // previous sunrise and next sunset if ( ((latitude > 66.4) && (doy > 79) && (doy < 267)) || ((latitude < -66.4) && ((doy < 83) || (doy > 263))) ) { newjd = findRecentSunrise(JD, latitude, longitude); newtime = calcSunriseUTC(newjd, latitude, longitude) - (60 * zone) + daySavings; if (newtime > 1440) { newtime -= 1440; newjd += 1.0; } if (newtime < 0) { newtime += 1440; newjd -= 1.0; } riseSetForm["sunrise"].value = timeStringAMPMDate(newtime, newjd); riseSetForm["utcsunrise"].value = "Anterior ^"; } // if Northern hemisphere and fall or winter, OR // if Southern hemisphere and spring or summer, use // next sunrise and previous sunset else if ( ((latitude > 66.4) && ((doy < 83) || (doy > 263))) || ((latitude < -66.4) && (doy > 79) && (doy < 267)) ) { newjd = findNextSunrise(JD, latitude, longitude); newtime = calcSunriseUTC(newjd, latitude, longitude) - (60 * zone) + daySavings; if (newtime > 1440) { newtime -= 1440; newjd += 1.0; } if (newtime < 0) { newtime += 1440; newjd -= 1.0; } riseSetForm["sunrise"].value = timeStringAMPMDate(newtime, newjd);// riseSetForm["sunrise"].value = calcDayFromJD(newjd)// + " " + timeStringDate(newtime, newjd); riseSetForm["utcsunrise"].value = "Proximo ^"; } else { alert("Nascer do Sol inexistente!"); } // alert("Ultimo nascer do Sol foi no dia " + findRecentSunrise(JD, latitude, longitude)); // alert("Proximo nascer do Sol sera no dia " + findNextSunrise(JD, latitude, longitude)); } if(nosunset) { riseSetForm["utcsunset"].value = ""; // if Northern hemisphere and spring or summer, OR // if Southern hemisphere and fall or winter, use // previous sunrise and next sunset if ( ((latitude > 66.4) && (doy > 79) && (doy < 267)) || ((latitude < -66.4) && ((doy < 83) || (doy > 263))) ) { newjd = findNextSunset(JD, latitude, longitude); newtime = calcSunsetUTC(newjd, latitude, longitude) - (60 * zone) + daySavings; if (newtime > 1440) { newtime -= 1440; newjd += 1.0; } if (newtime < 0) { newtime += 1440; newjd -= 1.0; } riseSetForm["sunset"].value = timeStringAMPMDate(newtime, newjd); riseSetForm["utcsunset"].value = "Proximo ^"; riseSetForm["utcsolnoon"].value = ""; } // if Northern hemisphere and fall or winter, OR // if Southern hemisphere and spring or summer, use // next sunrise and last sunset else if ( ((latitude > 66.4) && ((doy < 83) || (doy > 263))) || ((latitude < -66.4) && (doy > 79) && (doy < 267)) ) { newjd = findRecentSunset(JD, latitude, longitude); newtime = calcSunsetUTC(newjd, latitude, longitude) - (60 * zone) + daySavings; if (newtime > 1440) { newtime -= 1440; newjd += 1.0; } if (newtime < 0) { newtime += 1440; newjd -= 1.0; } riseSetForm["sunset"].value = timeStringAMPMDate(newtime, newjd); riseSetForm["utcsunset"].value = "Anterior ^"; riseSetForm["solnoon"].value = "Nao existe"; riseSetForm["utcsolnoon"].value