Code example for Calendar

Methods: setTimeZone

0
        buffer.append(hour).append(':').append(minute < 10 ? "0" + minute : minute);
        return buffer.toString();
    } 
 
    private double computeSolarEventTime(double solarZenith, Calendar date, boolean isSunrise) {
        date.setTimeZone(mTimeZone);
        double longitudeHour = getLongitudeHour(date, isSunrise);
        double meanAnomaly = getMeanAnomaly(longitudeHour);
        double sunTrueLong = getSunTrueLongitude(meanAnomaly);
        double cosineSunLocalHour = getCosineSunLocalHour(sunTrueLong, solarZenith);
        if ((cosineSunLocalHour < -1.0) || (cosineSunLocalHour > 1.0)) {
            return 0; 
        } 
 
        double sunLocalHour = getSunLocalHour(cosineSunLocalHour, isSunrise);
        double localMeanTime = getLocalMeanTime(sunTrueLong, longitudeHour, sunLocalHour);
        return getLocalTime(localMeanTime, date);
    } 
 
    /** 
     * Computes the base longitude hour, lngHour in the algorithm.