org.threeten.bp.LocalDate.getDayOfMonth()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.threeten.bp.LocalDate.getDayOfMonth()方法的一些代码示例,展示了LocalDate.getDayOfMonth()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.getDayOfMonth()方法的具体详情如下:
包路径:org.threeten.bp.LocalDate
类名称:LocalDate
方法名:getDayOfMonth

LocalDate.getDayOfMonth介绍

[英]Gets the day-of-month field.

This method returns the primitive int value for the day-of-month.
[中]获取月的日期字段。
此方法返回月日的原始int值。

代码示例

代码示例来源:origin: prolificinteractive/material-calendarview

/**
 * Get the day
 *
 * @return the day of the month for this day
 */
public int getDay() {
 return date.getDayOfMonth();
}

代码示例来源:origin: prolificinteractive/material-calendarview

@Override
public void writeToParcel(Parcel dest, int flags) {
 dest.writeInt(date.getYear());
 dest.writeInt(date.getMonthValue());
 dest.writeInt(date.getDayOfMonth());
}

代码示例来源:origin: prolificinteractive/material-calendarview

@Override
public String toString() {
 return "CalendarDay{" + date.getYear() + "-" + date.getMonthValue() + "-"
   + date.getDayOfMonth() + "}";
}

代码示例来源:origin: prolificinteractive/material-calendarview

@Override
public int hashCode() {
 return hashCode(date.getYear(), date.getMonthValue(), date.getDayOfMonth());
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Gets the day-of-month field.
 * <p>
 * This method returns the primitive {@code int} value for the day-of-month.
 *
 * @return the day-of-month, from 1 to 31
 */
public int getDayOfMonth() {
  return date.getDayOfMonth();
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Gets the day-of-month field.
 * <p>
 * This method returns the primitive {@code int} value for the day-of-month.
 *
 * @return the day-of-month, from 1 to 31
 */
public int getDayOfMonth() {
  return date.getDayOfMonth();
}

代码示例来源:origin: ThreeTen/threetenbp

private long monthsUntil(LocalDate end) {
  long packed1 = getProlepticMonth() * 32L + getDayOfMonth();  // no overflow
  long packed2 = end.getProlepticMonth() * 32L + end.getDayOfMonth();  // no overflow
  return (packed2 - packed1) / 32;
}

代码示例来源:origin: org.threeten/threetenbp

private long monthsUntil(LocalDate end) {
  long packed1 = getProlepticMonth() * 32L + getDayOfMonth();  // no overflow
  long packed2 = end.getProlepticMonth() * 32L + end.getDayOfMonth();  // no overflow
  return (packed2 - packed1) / 32;
}

代码示例来源:origin: ThreeTen/threetenbp

@Override
public int lengthOfYear() {
  Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
  jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
  jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
  return  jcal.getActualMaximum(Calendar.DAY_OF_YEAR);
}

代码示例来源:origin: org.threeten/threetenbp

@Override
public int lengthOfYear() {
  Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
  jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
  jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
  return  jcal.getActualMaximum(Calendar.DAY_OF_YEAR);
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Converts a {@code LocalDate} to a {@code java.sql.Date}.
 *
 * @param date  the local date, not null
 * @return the SQL date, not null
 */
@SuppressWarnings("deprecation")
public static java.sql.Date toSqlDate(LocalDate date) {
  return new java.sql.Date(date.getYear() - 1900, date.getMonthValue() -1, date.getDayOfMonth());
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Converts a {@code LocalDate} to a {@code java.sql.Date}.
 *
 * @param date  the local date, not null
 * @return the SQL date, not null
 */
@SuppressWarnings("deprecation")
public static java.sql.Date toSqlDate(LocalDate date) {
  return new java.sql.Date(date.getYear() - 1900, date.getMonthValue() -1, date.getDayOfMonth());
}

代码示例来源:origin: ThreeTen/threetenbp

private ValueRange actualRange(int calendarField) {
  Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
  jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
  jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
  return ValueRange.of(jcal.getActualMinimum(calendarField),
                 jcal.getActualMaximum(calendarField));
}

代码示例来源:origin: org.threeten/threetenbp

private ValueRange actualRange(int calendarField) {
  Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
  jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
  jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
  return ValueRange.of(jcal.getActualMinimum(calendarField),
                 jcal.getActualMaximum(calendarField));
}

代码示例来源:origin: ThreeTen/threetenbp

void adjustToFowards(int year) {
    if (adjustForwards == false && dayOfMonth > 0) {
      LocalDate adjustedDate = LocalDate.of(year, month, dayOfMonth).minusDays(6);
      dayOfMonth = adjustedDate.getDayOfMonth();
      month = adjustedDate.getMonth();
      adjustForwards = true;
    }
  }
}

代码示例来源:origin: org.threeten/threetenbp

void adjustToFowards(int year) {
    if (adjustForwards == false && dayOfMonth > 0) {
      LocalDate adjustedDate = LocalDate.of(year, month, dayOfMonth).minusDays(6);
      dayOfMonth = adjustedDate.getDayOfMonth();
      month = adjustedDate.getMonth();
      adjustForwards = true;
    }
  }
}

代码示例来源:origin: org.springframework.data/spring-data-cassandra

@Override
  public com.datastax.driver.core.LocalDate convert(LocalDate source) {
    return com.datastax.driver.core.LocalDate.fromYearMonthDay(source.getYear(), source.getMonthValue(),
        source.getDayOfMonth());
  }
}

代码示例来源:origin: ThreeTen/threetenbp

/**
 * Obtains the current month-day from the specified clock.
 * <p>
 * This will query the specified clock to obtain the current month-day.
 * Using this method allows the use of an alternate clock for testing.
 * The alternate clock may be introduced using {@link Clock dependency injection}.
 *
 * @param clock  the clock to use, not null
 * @return the current month-day, not null
 */
public static MonthDay now(Clock clock) {
  final LocalDate now = LocalDate.now(clock);  // called once
  return MonthDay.of(now.getMonth(), now.getDayOfMonth());
}

代码示例来源:origin: org.threeten/threetenbp

/**
 * Obtains the current month-day from the specified clock.
 * <p>
 * This will query the specified clock to obtain the current month-day.
 * Using this method allows the use of an alternate clock for testing.
 * The alternate clock may be introduced using {@link Clock dependency injection}.
 *
 * @param clock  the clock to use, not null
 * @return the current month-day, not null
 */
public static MonthDay now(Clock clock) {
  final LocalDate now = LocalDate.now(clock);  // called once
  return MonthDay.of(now.getMonth(), now.getDayOfMonth());
}

代码示例来源:origin: SouthernBox/NestedCalendar

@Override
  public void onDateSelected(@NonNull MaterialCalendarView widget,
                @NonNull CalendarDay calendarDay,
                boolean selected) {
    LocalDate localDate = calendarDay.getDate();
    WeekFields weekFields = WeekFields.of(Locale.getDefault());
    calendarBehavior.setWeekOfMonth(localDate.get(weekFields.weekOfMonth()));
    if (selected) {
      dayOfWeek = localDate.getDayOfWeek().getValue();
      dayOfMonth = localDate.getDayOfMonth();
    }
  }
});

相关文章