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


Java DateMidnight.withField方法代码示例

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


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

示例1: getCurrentWeek

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
public Interval getCurrentWeek() {
    final DateMidnight beginningOfSemester = new DateMidnight(getBegginingOfLessonPeriod());
    final DateMidnight firstMonday = beginningOfSemester.withField(DateTimeFieldType.dayOfWeek(), 1);
    final int currentWeek = calculateCurrentWeekOffset();
    final DateMidnight start = firstMonday.plusWeeks(currentWeek);
    return new Interval(start, start.plusWeeks(1));
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:8,代码来源:Attends.java

示例2: getResponseWeek

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
public Interval getResponseWeek() {
    final DateMidnight beginningOfSemester = new DateMidnight(getBegginingOfLessonPeriod());
    final DateMidnight firstMonday = beginningOfSemester.withField(DateTimeFieldType.dayOfWeek(), 1);
    final DateMidnight secondMonday = firstMonday.plusWeeks(1);

    final DateMidnight endOfSemester = new DateMidnight(getEndOfExamsPeriod());
    final DateMidnight lastMonday = endOfSemester.withField(DateTimeFieldType.dayOfWeek(), 1);
    final DateMidnight endOfResponsePeriod = lastMonday.plusWeeks(2);

    return (secondMonday.isEqualNow() || secondMonday.isBeforeNow()) && endOfResponsePeriod.isAfterNow() ? getPreviousWeek() : null;
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:12,代码来源:Attends.java

示例3: calculateCurrentWeekOffset

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
public int calculateCurrentWeekOffset() {
    final DateMidnight beginningOfLessonPeriod = new DateMidnight(getBegginingOfLessonPeriod());
    final DateMidnight firstMonday = beginningOfLessonPeriod.withField(DateTimeFieldType.dayOfWeek(), 1);
    final DateMidnight thisMonday = new DateMidnight().withField(DateTimeFieldType.dayOfWeek(), 1);

    final Interval interval = new Interval(firstMonday, thisMonday);

    return interval.toPeriod(PeriodType.weeks()).getWeeks();
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:10,代码来源:Attends.java

示例4: getThisMonday

import org.joda.time.DateMidnight; //导入方法依赖的package包/类
public DateMidnight getThisMonday() {
    final DateTime beginningOfSemester = getBeginDateYearMonthDay().toDateTimeAtMidnight();
    final DateTime endOfSemester = getEndDateYearMonthDay().toDateTimeAtMidnight();

    if (beginningOfSemester.isAfterNow() || endOfSemester.isBeforeNow()) {
        return null;
    }

    final DateMidnight now = new DateMidnight();
    return now.withField(DateTimeFieldType.dayOfWeek(), 1);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:12,代码来源:ExecutionSemester.java


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