GregorianCalendar(boolean ignored) { super(TimeZone.getDefault()); setFirstDayOfWeek(SUNDAY); setMinimalDaysInFirstWeek(1); }
GregorianCalendar(boolean ignored) { super(TimeZone.getDefault()); setFirstDayOfWeek(SUNDAY); setMinimalDaysInFirstWeek(1); }
GregorianCalendar(boolean ignored) { super(TimeZone.getDefault()); setFirstDayOfWeek(SUNDAY); setMinimalDaysInFirstWeek(1); }
GregorianCalendar(boolean ignored) { super(TimeZone.getDefault()); setFirstDayOfWeek(SUNDAY); setMinimalDaysInFirstWeek(1); }
/** * Method to set the minimal days in the week * @param value The minimal days in the week */ public void setMinimalDaysInFirstWeek(int value) { super.setMinimalDaysInFirstWeek(value); makeDirty(); }
GregorianCalendar(boolean ignored) { super(TimeZone.getDefault()); setFirstDayOfWeek(SUNDAY); setMinimalDaysInFirstWeek(1); }
GregorianCalendar(boolean ignored) { super(TimeZone.getDefault()); setFirstDayOfWeek(SUNDAY); setMinimalDaysInFirstWeek(1); }
GregorianCalendar(boolean ignored) { super(TimeZone.getDefault()); setFirstDayOfWeek(SUNDAY); setMinimalDaysInFirstWeek(1); }
GregorianCalendar(boolean ignored) { super(TimeZone.getDefault()); setFirstDayOfWeek(SUNDAY); setMinimalDaysInFirstWeek(1); }
/** * 返回该时间表示的第一天 FIXME * * @return */ public java.sql.Date getFirstDay() { if (null != getWeekstate()) { GregorianCalendar gc = new GregorianCalendar(); gc.setMinimalDaysInFirstWeek(1); gc.setTime(getStartOn()); gc.add(Calendar.WEEK_OF_YEAR, getWeekstate().getWeekList().get(0) - 1); gc.set(Calendar.HOUR_OF_DAY, 0); gc.set(Calendar.MINUTE, 0); gc.set(Calendar.SECOND, 0); gc.set(Calendar.MILLISECOND, 0); return new java.sql.Date(gc.getTime().getTime()); } else { return null; } }
final GregorianCalendar c = new GregorianCalendar(); c.setFirstDayOfWeek(Calendar.MONDAY); c.setMinimalDaysInFirstWeek(1); c.set(Calendar.YEAR, year); if (month != -1 && day != -1) {
/** * Converts a {@code ZonedDateTime} to a {@code Calendar}. * <p> * The resulting {@code GregorianCalendar} is pure Gregorian and uses * ISO week definitions, starting on Monday and with 4 days in a minimal week. * <p> * Fractions of the instant smaller than milliseconds will be dropped. * * @param zdt the zoned date-time, not null * @return the calendar, not null * @throws IllegalArgumentException if the conversion fails */ public static GregorianCalendar toGregorianCalendar(ZonedDateTime zdt) { TimeZone zone = toTimeZone(zdt.getZone()); GregorianCalendar cal = new GregorianCalendar(zone); cal.setGregorianChange(new Date(Long.MIN_VALUE)); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.setMinimalDaysInFirstWeek(4); try { cal.setTimeInMillis(zdt.toInstant().toEpochMilli()); } catch (ArithmeticException ex) { throw new IllegalArgumentException(ex); } return cal; }
@Override public Calendar from(ZonalDateTime time4j) { Date jud = TemporalType.JAVA_UTIL_DATE.from(time4j.toMoment()); TimeZone tz = TemporalType.JAVA_UTIL_TIMEZONE.from(time4j.getTimezone0()); GregorianCalendar gcal = new GregorianCalendar(); gcal.setGregorianChange(new Date(Long.MIN_VALUE)); // proleptic gregorian gcal.setFirstDayOfWeek(Calendar.MONDAY); // keeping ISO-8601-semantic gcal.setMinimalDaysInFirstWeek(4); // keeping ISO-8601-semantic gcal.setTimeZone(tz); gcal.setTime(jud); return gcal; }
selectedDate.get(Calendar.MONTH), 1); c.setMinimalDaysInFirstWeek(1);// fix for different locales c.setFirstDayOfWeek(Calendar.SUNDAY);
/** * Converts a {@code ZonedDateTime} to a {@code Calendar}. * <p> * The resulting {@code GregorianCalendar} is pure Gregorian and uses * ISO week definitions, starting on Monday and with 4 days in a minimal week. * <p> * Fractions of the instant smaller than milliseconds will be dropped. * * @param zdt the zoned date-time, not null * @return the calendar, not null * @throws IllegalArgumentException if the conversion fails */ public static GregorianCalendar toGregorianCalendar(ZonedDateTime zdt) { TimeZone zone = toTimeZone(zdt.getZone()); GregorianCalendar cal = new GregorianCalendar(zone); cal.setGregorianChange(new Date(Long.MIN_VALUE)); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.setMinimalDaysInFirstWeek(4); try { cal.setTimeInMillis(zdt.toInstant().toEpochMilli()); } catch (ArithmeticException ex) { throw new IllegalArgumentException(ex); } return cal; }
/** * Converts a {@code ZonedDateTime} to a {@code Calendar}. * <p> * The resulting {@code GregorianCalendar} is pure Gregorian and uses * ISO week definitions, starting on Monday and with 4 days in a minimal week. * <p> * Fractions of the instant smaller than milliseconds will be dropped. * * @param zdt the zoned date-time, not null * @return the calendar, not null * @throws IllegalArgumentException if the conversion fails */ public static GregorianCalendar toGregorianCalendar(ZonedDateTime zdt) { TimeZone zone = toTimeZone(zdt.getZone()); GregorianCalendar cal = new GregorianCalendar(zone); cal.setGregorianChange(new Date(Long.MIN_VALUE)); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.setMinimalDaysInFirstWeek(4); try { cal.setTimeInMillis(zdt.toInstant().toEpochMilli()); } catch (ArithmeticException ex) { throw new IllegalArgumentException(ex); } return cal; }
final GregorianCalendar c = new GregorianCalendar(); c.setFirstDayOfWeek(Calendar.MONDAY); c.setMinimalDaysInFirstWeek(1); c.set(Calendar.YEAR, year); c.set(Calendar.WEEK_OF_YEAR, week);
cal.setMinimalDaysInFirstWeek(4); int week = Integer.parseInt(last.substring(1)); if(week > cal.getActualMaximum(Calendar.WEEK_OF_MONTH)) {
public static GregorianCalendar from(ZonedDateTime zdt) { GregorianCalendar cal = new MockGregorianCalendar(MockTimeZone.getTimeZone(zdt.getZone())); cal.setGregorianChange(new MockDate(Long.MIN_VALUE)); cal.setFirstDayOfWeek(MONDAY); cal.setMinimalDaysInFirstWeek(4); try { cal.setTimeInMillis(Math.addExact(Math.multiplyExact(zdt.toEpochSecond(), 1000), zdt.get(ChronoField.MILLI_OF_SECOND))); } catch (ArithmeticException ex) { throw new IllegalArgumentException(ex); } return cal; } }
cal = _tupletocal(tup); cal.setFirstDayOfWeek(Calendar.SUNDAY); cal.setMinimalDaysInFirstWeek(7); j = cal.get(Calendar.WEEK_OF_YEAR); if (cal.get(Calendar.MONTH) == Calendar.JANUARY && j >= 52) cal = _tupletocal(tup); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.setMinimalDaysInFirstWeek(7); j = cal.get(Calendar.WEEK_OF_YEAR);