Calculates the day of the year for the beginning of the month.
349377
private long monthToDayOfYear(long month, boolean isLeapYear)
  {
    long day = 0;

    for (int i = 0; i < month && i < 12; i++) {
      day += DAYS_IN_MONTH[i];
      if (i == 1 && isLeapYear)
        day++;
    }

    return day;
  }
94585
def dateJDN(year, month, day, calendar):
    
    a = (14 - month) // 12
    y = year + 4800 - a
    m = month + 12*a - 3
    if calendar == GREGORIAN:
        return day + (153*m + 2)//5 + 365*y + y//4 - y//100 + y//400 - 32045
    else:
        return day + (153*m + 2)//5 + 365*y + y//4 - 32083
1110653
public static Calendar startOfMonth(Calendar origin) {
        Calendar cal = (Calendar) origin.clone();
        cal.set(Calendar.MILLISECOND, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.DAY_OF_MONTH, 1);
        return cal;
    }
581630
function(year) {
			var months = Math.floor((235 * year - 234) / 19);
			var parts = 12084 + 13753 * months;
			var day = months * 29 + Math.floor(parts / 25920);
			if (mod(3 * (day + 1), 7) < 3) {
				day++;
			}
			return day;
		}
1349328
private int monthLength(int month) {
        int year = internalGet(YEAR);
        if (internalGetEra() == BCE) {
            year = 1 - year;
        }
        return monthLength(month, year);
    }
253042
private static Date getDate(int day, int month, int year) {
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, year);
		cal.set(Calendar.MONTH, month);
		cal.set(Calendar.DATE, day);
		return cal.getTime();
	}
1322201
def get_month_start(day=None):
    """"""
    day = add_timezone(day or datetime.date.today())
    return day.replace(day=1)
877030
function getMonthDays(year, month) {
  let NUM = 30;
  if ([1, 3, 5, 7, 8, 10, 12].indexOf(month) !== -1) {
    NUM = 31;
  }
  if (month === 2) {
    NUM = isLeapYear(year) ? 29 : 28;
  }
  return NUM;
}
1252761
function(calendar) {
					while (m < calendar.minMonth) {
						y--;
						m += calendar.monthsInYear(y);
					}
					var yearMonths = calendar.monthsInYear(y);
					while (m > yearMonths - 1 + calendar.minMonth) {
						y++;
						m -= yearMonths;
						yearMonths = calendar.monthsInYear(y);
					}
				}
1332688
function (year) {
			var daysCount = 0;
			for (var i = 1; i <= 12; i++) {
				daysCount += this.daysInMonth(year, i);
			}
			return daysCount;
		}
686137
private void addMonth(int i) {
        Calendar cal = Calendar.getInstance();
        cal.set(getDisplayYear(), getDisplayMonth() - 1, 1);
        int month = cal.get(Calendar.MONTH) + 1;
        if (i > 0 && month == 12) {
            addYear(1);
        }

        if (i < 0 && month == 1) {
            addYear(-1);
        }
        cal.add(Calendar.MONTH, i);

        monthTextField.setText(String.valueOf(cal.get(Calendar.MONTH) + 1));

    }
146188
function adjustDayOfMonth(self) {
        var fields = self.fields;
        var year = fields[YEAR];
        var month = fields[MONTH];
        var monthLen = getMonthLength(year, month);
        var dayOfMonth = fields[DAY_OF_MONTH];
        if (dayOfMonth > monthLen) {
            self.set(DAY_OF_MONTH, monthLen);
        }
    }
941945
public static Date getDate(int year, int month, int day) {
        GregorianCalendar d = new GregorianCalendar(year, month - 1, day);
        return d.getTime();
    }
618428
private int diff360EIsda(final LocalDate start, final LocalDate end) {
        if (start.equals(end)) {
            return 0;
        }
        int dayStart = start.getDayOfMonth();
        int dayEnd = end.getDayOfMonth();
        if (start.getMonth().length(start.isLeapYear()) == dayStart) {
            dayStart = CalculatorConstants.MONTH_30_DAYS;
        }
        if (end.getMonth() != Month.FEBRUARY && end.getMonth().length(end.isLeapYear()) == dayEnd) {
            dayEnd = CalculatorConstants.MONTH_30_DAYS;
        }
        return (end.getYear() - start.getYear()) * CalculatorConstants.YEAR_360 + (end.getMonthValue() - start.getMonthValue()) * CalculatorConstants.MONTH_30_DAYS + dayEnd - dayStart;
    }
1039745
function(year, month, day) {
    var dayOfWeek = this.createDate(year, month, day).getDay();
    return dayOfWeek === this.SATURDAY || dayOfWeek === this.SUNDAY;
  }
526220
public void setDate(int year, int month, int day) {
        Calendar to = Calendar.getInstance();
        to.set(year, month, day);
        setDate(to);
    }
47227
public int toInt()
	{
		int day = ((year + 1900) * 12 + month) * 31 + (date - 1);

		if( day < TIME_BEGIN )
			day = TIME_BEGIN;
		else if( day > TIME_END )
			day = TIME_END;

		return day;
	}