Logo Search packages:      
Sourcecode: icu version File versions  Download package

uint8_t Calendar::julianDayToDayOfWeek ( double  julian  )  [static, protected, inherited]

Convert a quasi Julian date to the day of the week. The Julian date used here is not a true Julian date, since it is measured from midnight, not noon. Return value is one-based.

julian The given Julian date number.
Day number from 1..7 (SUN..SAT).

For internal use only.

Definition at line 1273 of file calendar.cpp.

References UCAL_SUNDAY.

Referenced by Calendar::computeGregorianAndDOWFields(), Calendar::handleComputeJulianDay(), and Calendar::handleGetExtendedYearFromWeekFields().

    // If julian is negative, then julian%7 will be negative, so we adjust
    // accordingly.  We add 1 because Julian day 0 is Monday.
    int8_t dayOfWeek = (int8_t) uprv_fmod(julian + 1, 7);

    uint8_t result = (uint8_t)(dayOfWeek + ((dayOfWeek < 0) ? (7+UCAL_SUNDAY ) : UCAL_SUNDAY));
    return result;

Generated by  Doxygen 1.6.0   Back to index