Convenience method for `_set_year`, `_set_month`...
977643
def _set_thing(self, thing, value):
        """"""
        try:
            value = int(value)
        except (TypeError, ValueError):
            raise TypeError(
                f'Changing the {thing} of a `Date` instance is only '
                f'allowed via numbers, but the given value `{value}` '
                f'is of type `{type(value)}` instead.')
        kwargs = {}
        for unit in ('year', 'month', 'day', 'hour', 'minute', 'second'):
            kwargs[unit] = getattr(self, unit)
        kwargs[thing] = value
        self.datetime = datetime.datetime(**kwargs)
810910
public long setDate(long year, long month, long day)
  {
    year += (long) Math.floor(month / 12.0);
    month -= (long) 12 * Math.floor(month / 12.0);

    _year = year;
    _month = month;
    _dayOfMonth = day - 1;

    calculateJoin();
    calculateSplit(_localTimeOfEpoch);

    return _localTimeOfEpoch;
  }
139195
def fmt(self):
        
        val = str(self.year)
        if self.month is not None:
            val += ' ' + str(self.month)
            if self.day is not None:
                val += ' ' + str(self.day)
        return val
1273826
public void goTo(int month, int year){
        int position = mAdapter.positionOfMonth(month, year);
        postSetSelectionFromTop(position, 0);
    }
1243166
function setMonth( $month )
    {
        $arr = getdate( $this->Date );
        $this->Date = mktime( 0, 0, 0, $month, $arr['mday'], $arr['year'] );
    }
1060111
def canceled_during(self, year, month):
		""""""
		return self.canceled().filter(canceled_at__year=year, canceled_at__month=month)
541312
function(year) {
	var yr;
	
	if (!year) {
		
		// initialize date "buckets" for year and month;
		year = [1900, 2100];
		this._years = {};
		for (yr = year[0]; yr <= year[1]; yr += 1) {
			this._years[yr] = new Year(yr);
		}
	} else {
		this.year = year;
	}
	return this;
}
245735
public void setDate(
            final int year,
            final int monthOfYear,
            final int dayOfMonth) {
        Chronology c = getChronology();
        long instantMidnight = c.getDateTimeMillis(year, monthOfYear, dayOfMonth, 0);
        setDate(instantMidnight);
    }
71227
def set_year(self, year):
        
        self._set_attr(TDRC(encoding=3, text=str(year)))
1208163
def monthly(date=datetime.date.today()):
    
    return datetime.date(date.year, date.month, 1)
330635
private int getMonthLength(int year, int month) {
        int days = DAYS_IN_MONTH[month];
        if (month == FEBRUARY && isLeapYear(year)) {
            days++;
        }
        return days;
    }
1095977
function setMonth( $month )
    {
        $arr = getdate( $this->DateTime );
        $this->DateTime = mktime( $arr['hours'], $arr['minutes'], $arr['seconds'],
                                  $month, $arr['mday'], $arr['year'] );
    }
977815
def set_year(self, year):
        
        self.year = YEARS.get(year, year)
        data = {'idCursus': self.year}
        soup = self.post_soup('/~etudiant/login.php', data=data)
        return bool(soup.select('ul.rMenu-hor'))
287915
function setMDY( $month, $day = 0, $year = 0 )
    {
        if ( $year != 0 )
            $date = mktime( 0, 0, 0, $month, $day, $year );
        else if ( $day != 0 )
            $date = mktime( 0, 0, 0, $month, $day );
        else
            $date = mktime( 0, 0, 0, $month );
        $this->Date = $date;
    }
326834
function SimpleDate(){
    this._monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
    this._monthNamesShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

    var tempDate = new Date();
    this.setYear(tempDate.getFullYear());
    this.setMonth(tempDate.getMonth());
    this.setDate(tempDate.getDate());

    if(arguments[0] != null) {
        if (arguments[0] instanceof Date) {
            tempDate = arguments[0];

            this.setYear(tempDate.getFullYear());
            this.setMonth(tempDate.getMonth());
            this.setDate(tempDate.getDate());
        } else if(arguments[0] instanceof SimpleDate) {
            this.setYear(arguments[0].getYear());
            this.setMonth(arguments[0].getMonth());
            this.setDate(arguments[0].getDate());
        } else if(arguments[0] instanceof Object) {
            var obj = arguments[0];
            if(obj.year != null && obj.month != null && obj.date != null) {
                this.setYear(obj.year);
                this.setMonth(obj.month);
                this.setDate(obj.date);
            } else {
                this.setYear(tempDate.getFullYear());
                this.setMonth(tempDate.getMonth());
                this.setDate(tempDate.getDate());
            }
        }else {
            try {
                this.setYear(parseInt(arguments[0]));
                this.setMonth(parseInt(arguments[1]));
                this.setDate(parseInt(arguments[2]));
            }catch(e) {
                this.setYear(tempDate.getFullYear());
                this.setMonth(tempDate.getMonth());
                this.setDate(tempDate.getDate());
            }
        }
    }
}
460336
public long set(int field, long value)
  {
    switch (field) {
    case YEAR:
      setYear((int) value);
      break;

    case MONTH:
      setMonth((int) value);
      break;

    case DAY_OF_MONTH:
      setDayOfMonth((int) value);
      break;

    case HOUR:
      setHour((int) value);
      break;

    case MINUTE:
      setMinute((int) value);
      break;

    case SECOND:
      setSecond((int) value);
      break;

    case MILLISECOND:
      setMillisecond(value);
      break;

    default:
      throw new RuntimeException();
    }

    return _localTimeOfEpoch;
  }
1049227
private function setMonth($month) {
        
        //preventing duplication process
        if ($month == $this->month) {
            return;
        }
        $yearToSet  = $this->year;
        $monthToSet = $month;
        
        if ($monthToSet < 1) {
            $monthToSet = abs($monthToSet);
            $yearToSet--;
            
            $yearToSet  -= floor($monthToSet / 12);
            $monthToSet = 12 - ($monthToSet % 12);
            
        } elseif ($monthToSet > 12) {
            $yearToSet  += floor($monthToSet / 12);
            $monthToSet = ($month % 12);
            if ($monthToSet == 0) {
                $monthToSet = 12;
                $yearToSet--;
            }
        }
        
        $this->month = (int) $monthToSet;
        $this->setYear($yearToSet);
    }