src/sap.ui.core/src/sap/ui/core/date/Islamic.js
function toIslamic(oGregorian) {
		var iGregorianYear = oGregorian.year,
			iGregorianMonth = oGregorian.month,
			iGregorianDay = oGregorian.day,
			iIslamicYear,
			iIslamicMonth,
			iIslamicDay,
			iMonths,
			iDays,
			iLeapAdj,
			iJulianDay;

		iLeapAdj = 0;
		if ((iGregorianMonth + 1) > 2) {
			iLeapAdj = isGregorianLeapYear(iGregorianYear) ? -1 : -2;
		}
		iJulianDay = (GREGORIAN_EPOCH_DAYS - 1) + (365 * (iGregorianYear - 1)) + Math.floor((iGregorianYear - 1) / 4)
			+ (-Math.floor((iGregorianYear - 1) / 100)) + Math.floor((iGregorianYear - 1) / 400)
			+ Math.floor((((367 * (iGregorianMonth + 1)) - 362) / 12)
			+ iLeapAdj + iGregorianDay);

		iJulianDay = Math.floor(iJulianDay) + 0.5;

		iDays = iJulianDay - ISLAMIC_EPOCH_DAYS;

		iMonths = Math.floor(iDays / 29.530588853); // day/CalendarAstronomer.SYNODIC_MONTH

		if (iMonths < 0) { //negative means Islamic date before the Islamic's calendar start. So we do not apply customization.
			iIslamicYear = Math.floor(iMonths / 12) + 1;
			iIslamicMonth = iMonths % 12;
			if (iIslamicMonth < 0) {
				iIslamicMonth += 12;
			}
			iIslamicDay = iDays - monthStart(iIslamicYear, iIslamicMonth) + 1;
		} else {
			/* Guess the month start.
			 * Always also check the next month, since customization can
			 * differ. It can differ for not more than 3 days. so that
			 * checking the next month is enough.
			 */
			iMonths++;

			/*
			 * Check the true month start for the given month. If it is
			 * later, check the previous month, until a suitable is found.
			 */
			while (getCustomMonthStartDays(iMonths) > iDays) {
				iMonths--;
			}
			iIslamicYear = Math.floor(iMonths / 12) + 1;
			iIslamicMonth = iMonths % 12;
			iIslamicDay = (iDays - getCustomMonthStartDays(12 * (iIslamicYear - 1) + iIslamicMonth)) + 1;
		}

		return {
			day: iIslamicDay,
			month: iIslamicMonth,
			year: iIslamicYear
		};
	}
function toIslamic(oGregorian) {
		var iGregorianYear = oGregorian.year,
			iGregorianMonth = oGregorian.month,
			iGregorianDay = oGregorian.day,
			iIslamicYear,
			iIslamicMonth,
			iIslamicDay,
			iMonths,
			iDays,
			iLeapAdj,
			iJulianDay;

		iLeapAdj = 0;
		if ((iGregorianMonth + 1) > 2) {
			iLeapAdj = isGregorianLeapYear(iGregorianYear) ? -1 : -2;
		}
		iJulianDay = (GREGORIAN_EPOCH_DAYS - 1) + (365 * (iGregorianYear - 1)) + Math.floor((iGregorianYear - 1) / 4)
			+ (-Math.floor((iGregorianYear - 1) / 100)) + Math.floor((iGregorianYear - 1) / 400)
			+ Math.floor((((367 * (iGregorianMonth + 1)) - 362) / 12)
			+ iLeapAdj + iGregorianDay);

		iJulianDay = Math.floor(iJulianDay) + 0.5;

		iDays = iJulianDay - ISLAMIC_EPOCH_DAYS;

		iMonths = Math.floor(iDays / 29.530588853); // day/CalendarAstronomer.SYNODIC_MONTH

		if (iMonths < 0) { //negative means Islamic date before the Islamic's calendar start. So we do not apply customization.
			iIslamicYear = Math.floor(iMonths / 12) + 1;
			iIslamicMonth = iMonths % 12;
			if (iIslamicMonth < 0) {
				iIslamicMonth += 12;
			}
			iIslamicDay = iDays - monthStart(iIslamicYear, iIslamicMonth) + 1;
		} else {
			/* Guess the month start.
			 * Always also check the next month, since customization can
			 * differ. It can differ for not more than 3 days. so that
			 * checking the next month is enough.
			 */
			iMonths++;

			/*
			 * Check the true month start for the given month. If it is
			 * later, check the previous month, until a suitable is found.
			 */
			while (getCustomMonthStartDays(iMonths) > iDays) {
				iMonths--;
			}
			iIslamicYear = Math.floor(iMonths / 12) + 1;
			iIslamicMonth = iMonths % 12;
			iIslamicDay = (iDays - getCustomMonthStartDays(12 * (iIslamicYear - 1) + iIslamicMonth)) + 1;
		}

		return {
			day: iIslamicDay,
			month: iIslamicMonth,
			year: iIslamicYear
		};
	}
function toIslamic ( oGregorian ) { var iGregorianYear = oGregorian . year , iGregorianMonth = oGregorian . month , iGregorianDay = oGregorian . day , iIslamicYear , iIslamicMonth , iIslamicDay , iMonths , iDays , iLeapAdj , iJulianDay ; iLeapAdj = 0 ; if ( ( iGregorianMonth + 1 ) > 2 ) { iLeapAdj = isGregorianLeapYear ( iGregorianYear ) ? - 1 : - 2 ; } iJulianDay = ( GREGORIAN_EPOCH_DAYS - 1 ) + ( 365 * ( iGregorianYear - 1 ) ) + Math . floor ( ( iGregorianYear - 1 ) / 4 ) + ( - Math . floor ( ( iGregorianYear - 1 ) / 100 ) ) + Math . floor ( ( iGregorianYear - 1 ) / 400 ) + Math . floor ( ( ( ( 367 * ( iGregorianMonth + 1 ) ) - 362 ) / 12 ) + iLeapAdj + iGregorianDay ) ; iJulianDay = Math . floor ( iJulianDay ) + 0.5 ; iDays = iJulianDay - ISLAMIC_EPOCH_DAYS ; iMonths = Math . floor ( iDays / 29.530588853 ) ; // day/CalendarAstronomer.SYNODIC_MONTH if ( iMonths < 0 ) { //negative means Islamic date before the Islamic's calendar start. So we do not apply customization. iIslamicYear = Math . floor ( iMonths / 12 ) + 1 ; iIslamicMonth = iMonths % 12 ; if ( iIslamicMonth < 0 ) { iIslamicMonth += 12 ; } iIslamicDay = iDays - monthStart ( iIslamicYear , iIslamicMonth ) + 1 ; } else { /* Guess the month start.
			 * Always also check the next month, since customization can
			 * differ. It can differ for not more than 3 days. so that
			 * checking the next month is enough.
			 */ iMonths ++ ; /*
			 * Check the true month start for the given month. If it is
			 * later, check the previous month, until a suitable is found.
			 */ while ( getCustomMonthStartDays ( iMonths ) > iDays ) { iMonths -- ; } iIslamicYear = Math . floor ( iMonths / 12 ) + 1 ; iIslamicMonth = iMonths % 12 ; iIslamicDay = ( iDays - getCustomMonthStartDays ( 12 * ( iIslamicYear - 1 ) + iIslamicMonth ) ) + 1 ; } return { day : iIslamicDay , month : iIslamicMonth , year : iIslamicYear } ; }
Calculate islamic date from gregorian.

@param {object} oGregorian A JS object containing day, month and year in the gregorian calendar
@returns {object} The islamic date object created
@private
Calculate islamic date from gregorian .