当前位置: 首页>>代码示例>>Java>>正文


Java LocalDate.minusWeeks方法代码示例

本文整理汇总了Java中java.time.LocalDate.minusWeeks方法的典型用法代码示例。如果您正苦于以下问题:Java LocalDate.minusWeeks方法的具体用法?Java LocalDate.minusWeeks怎么用?Java LocalDate.minusWeeks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.LocalDate的用法示例。


在下文中一共展示了LocalDate.minusWeeks方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateStartDate

import java.time.LocalDate; //导入方法依赖的package包/类
private LocalDate calculateStartDate() {
    LocalDate startDate = getDate();

    if (isAdjustToFirstDayOfWeek()) {
        LocalDate newStartDate = startDate.with(DAY_OF_WEEK, getFirstDayOfWeek().getValue());
        if (newStartDate.isAfter(startDate)) {
            startDate = newStartDate.minusWeeks(1);
        } else {
            startDate = newStartDate;
        }
    }

    return startDate;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:15,代码来源:WeekView.java

示例2: getDate

import java.time.LocalDate; //导入方法依赖的package包/类
private LocalDate getDate(LocalDate startDate, int dayCount) {
    if (getSkinnable().isAdjustToFirstDayOfWeek()) {
        LocalDate newStartDate = startDate.with(DAY_OF_WEEK, getSkinnable().getFirstDayOfWeek().getValue());
        if (newStartDate.isAfter(startDate)) {
            startDate = newStartDate.minusWeeks(1);
        } else {
            startDate = newStartDate;
        }
    }

    return startDate.plusDays(dayCount);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:13,代码来源:WeekDayHeaderViewSkin.java

示例3: adjustToFirstDayOfWeek

import java.time.LocalDate; //导入方法依赖的package包/类
/**
 * Adjusts the given date to a new date that marks the beginning of the week where the
 * given date is located. If "Monday" is the first day of the week and the given date
 * is a "Wednesday" then this method will return a date that is two days earlier than the
 * given date.
 *
 * @param date           the date to adjust
 * @param firstDayOfWeek the day of week that is considered the start of the week ("Monday" in Germany, "Sunday" in the US)
 * @return the date of the first day of the week
 * @see #adjustToLastDayOfWeek(LocalDate, DayOfWeek)
 * @see DateControl#getFirstDayOfWeek()
 */
public static LocalDate adjustToFirstDayOfWeek(LocalDate date, DayOfWeek firstDayOfWeek) {
    LocalDate newDate = date.with(DAY_OF_WEEK, firstDayOfWeek.getValue());
    if (newDate.isAfter(date)) {
        newDate = newDate.minusWeeks(1);
    }

    return newDate;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:21,代码来源:Util.java


注:本文中的java.time.LocalDate.minusWeeks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。