Converts the Calendar to a corresponding {@link java.time.Month}. If the Calendar has a different
time zone than the system default, the Month will be adjusted into the default time zone.

@param self a Calendar
@return a Month
@since 2.5.0
349866
public static Month toMonth(final Calendar self) {
        return Month.of(self.get(Calendar.MONTH) + 1);
    }
1214424
public static Calendar toCalendar(final long millis)
	{
		final Calendar calendar = Calendar.getInstance();
		calendar.setTimeInMillis(millis);
		return calendar;
	}
1260354
public static DayOfWeek toDayOfWeek(final Calendar self) {
        return DayOfWeek.of(self.get(Calendar.DAY_OF_WEEK)).minus(1);
    }
668630
public static int getMonth(Date date) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        return c.get(Calendar.MONTH);
    }
277825
public Date toDate(Calendar c) {
		c.clear();
		c.set(Calendar.YEAR, year);
		c.set(Calendar.MONTH, month - 1);
		c.set(Calendar.DATE, date);
		c.set(Calendar.HOUR_OF_DAY, hour);
		c.set(Calendar.MINUTE, minute);
		c.set(Calendar.SECOND, second);
		return c.getTime();
	}
409125
public void setCalendar(int year, int month, int dayOfMonth, int hour, int minute, int second) {
        this.year = year;
        this.month = month;
        this.dayOfMonth = dayOfMonth;
        this.hour = hour;
        this.minute = minute;
        this.second = second;
        this.createCalendar();
    }
1153307
public static Date plus(Date self, int days) {
        Calendar calendar = (Calendar) Calendar.getInstance().clone();
        calendar.setTime(self);
        calendar.add(Calendar.DAY_OF_YEAR, days);
        return calendar.getTime();
    }
1049927
public int getMonth()
    {
        Timestamp adjusted = this;

        if (this._offset != null) {
            if (this._offset.intValue() != 0) {
                adjusted = make_localtime();
            }
        }
        return adjusted._month;
    }
1191539
private Calendar createCalendar(long time)
    {
        // The specification accounts for gregorian dates only.
        Calendar cal = new GregorianCalendar(timeZone); // d639610
        cal.setTimeInMillis(time);

        return cal;
    }
1373720
public static Integer getDayOfMonth(Date date) {

        if (date == null)
            return null;

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);

        return calendar.get(Calendar.DAY_OF_MONTH);
    }
372180
public static final <T extends Calendar> Function<T, DateTime> calendarToDateTime(DateTimeZone dateTimeZone) {
		return FnDateTime.calendarToDateTime(dateTimeZone);
	}
1057986
public static AnnualDate of(
        int month,
        int dayOfMonth
    ) {

        check(month, dayOfMonth);
        return new AnnualDate(month, dayOfMonth);

    }
635335
private static Calendar getCalendar(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar;
    }
355273
public TimeZone getTimeZone()
    {
        if ( fDateFormat != null ) {
            // Here we clone, like other getters here, but unlike
            // DateFormat.getTimeZone() and Calendar.getTimeZone()
            // which return the TimeZone from the Calendar's zone variable
            return (TimeZone)(fDateFormat.getTimeZone().clone());
        }
        // If fDateFormat is null (unexpected), return default timezone.
        return TimeZone.getDefault();
    }
644596
@Nonnull
  public static GregorianCalendar getCalendarDefaultTimeZone (final long nMillis)
  {
    final GregorianCalendar aCalendar = new GregorianCalendar (PDTConfig.getDefaultTimeZone (),
                                                               Locale.getDefault (Locale.Category.FORMAT));
    aCalendar.setTimeInMillis (nMillis);
    return aCalendar;
  }
1149188
private static Calendar dateToCalendar(Date date) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		return cal;
	}
1331053
private Calendar adjustDayInMonthIfNeeded(Calendar calendar) {
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
        if (day > daysInMonth) {
            calendar.set(Calendar.DAY_OF_MONTH, daysInMonth);
        }
        return mDateRangeLimiter.setToNearestDate(calendar);
    }