當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalDate.minusDays方法代碼示例

本文整理匯總了Java中org.joda.time.LocalDate.minusDays方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalDate.minusDays方法的具體用法?Java LocalDate.minusDays怎麽用?Java LocalDate.minusDays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.joda.time.LocalDate的用法示例。


在下文中一共展示了LocalDate.minusDays方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDeadline

import org.joda.time.LocalDate; //導入方法依賴的package包/類
private DateTime getDeadline(LocalDate date) {
    Settings settings = settingsRepo.findById(1);
    int deadlineDays = settings.getDeadlineDays();
    LocalTime deadlineTime = settings.getDeadline();
     
    date = date.minusDays(deadlineDays);
    
    while (this.holidaysRepo.findByIdHoliday(date) != null) {
         date = date.minusDays(1);
    }        
    
    // Check if order deadline passed based on given date, deadlineDays and deadlineTime (deadline)
    //return (date.toLocalDateTime(deadlineTime).compareTo(LocalDateTime.now()) < 0);

    // When we ll change deadline time to utc, use this: 
    //return date.toLocalDateTime(deadlineTime).toDateTime(DateTimeZone.UTC);
    return date.toLocalDateTime(deadlineTime).toDateTime(); // To default zone
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:19,代碼來源:MenusService.java

示例2: oldDeadlinePassed

import org.joda.time.LocalDate; //導入方法依賴的package包/類
private boolean oldDeadlinePassed(LocalDate date, int deadlineDays, LocalTime deadlineTime) {
    // Check if order deadline passed based on given date, deadlineDays and deadlineTime (deadline)
    date = date.minusDays(deadlineDays);
    while (this.holidaysRepo.findByIdHoliday(date) != null) {
         date = date.minusDays(1);
    }  
    return (date.toLocalDateTime(deadlineTime).compareTo(LocalDateTime.now()) < 0);
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:9,代碼來源:GlobalsettingsService.java

示例3: menusWeeklyGet

import org.joda.time.LocalDate; //導入方法依賴的package包/類
@Transactional
public List<DailyMenu> menusWeeklyGet(Long userId) throws ApiException, Exception {
    LocalDate today = LocalDate.now();
    LocalDate firstDayOfWeek = today.minusDays(today.getDayOfWeek() - 1);
    List<com.jrtechnologies.yum.api.model.DailyMenu> weeklyMenu = new ArrayList<>();
    for (int i = 0; i < 7; i++) {
        DailyMenu dailymenu = createWeekDailyMenu(firstDayOfWeek.plusDays(i), userId);
        if (dailymenu.getDate() != null) {
            weeklyMenu.add(dailymenu);
        }
    }
    return weeklyMenu;
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:14,代碼來源:MenusService.java

示例4: deadlinePassed

import org.joda.time.LocalDate; //導入方法依賴的package包/類
public boolean deadlinePassed(LocalDate date) {
    Settings settings = settingsRepo.findOne(1);
    int deadlineDays = settings.getDeadlineDays();
    LocalTime deadlineTime = settings.getDeadline();
     
    date = date.minusDays(deadlineDays);
    
    while (this.holidaysRepo.findByIdHoliday(date) != null) {
         date = date.minusDays(1);
    }        
    
    // Check if order deadline passed based on given date, deadlineDays and deadlineTime (deadline)
    return (date.toLocalDateTime(deadlineTime).compareTo(LocalDateTime.now()) < 0);
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:15,代碼來源:DailyMenuService.java

示例5: deadlinePassed

import org.joda.time.LocalDate; //導入方法依賴的package包/類
public boolean deadlinePassed(LocalDate date) {
    Settings settings = settingsRep.findOne(1);
    int deadlineDays = settings.getDeadlineDays();
    LocalTime deadlineTime = settings.getDeadline();

    date = date.minusDays(deadlineDays);

    while (this.holidaysRepo.findByIdHoliday(date) != null) {
        date = date.minusDays(1);
    }

    // Check if order deadline passed based on given date, deadlineDays and deadlineTime (deadline)
    return (date.toLocalDateTime(deadlineTime).compareTo(LocalDateTime.now()) < 0);
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:15,代碼來源:OrdersService.java

示例6: deadlinePassed

import org.joda.time.LocalDate; //導入方法依賴的package包/類
public boolean deadlinePassed(LocalDate date) {
    Settings settings = settingsRepo.findOne(1);
    int deadlineDays = settings.getDeadlineDays();
    LocalTime deadlineTime = settings.getDeadline();

    date = date.minusDays(deadlineDays);

    while (this.holidaysRepo.findByIdHoliday(date) != null) {
        date = date.minusDays(1);
    }

    // Check if order deadline passed based on given date, deadlineDays and deadlineTime (deadline)
    return (date.toLocalDateTime(deadlineTime).compareTo(LocalDateTime.now()) < 0);
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:15,代碼來源:UsersService.java

示例7: menusWeeklyWeekGet

import org.joda.time.LocalDate; //導入方法依賴的package包/類
@Transactional
public List<DailyMenu> menusWeeklyWeekGet(String week, Long userId) throws ApiException, Exception {
     
    
    String patternString = "^\\d{2}-\\d{4}$";
    java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(patternString);
    Matcher matcher = pattern.matcher(week);
    if (matcher.matches()) {
        int year = Integer.parseInt(week.substring(3, 7)); 
        
        int weekNumber = Integer.parseInt(week.substring(0, 2));
        int weeksOfYear = getWeeksofYear(year);
        //Validation check for weeks number.
        if (weekNumber < 1 || weekNumber > 53 || (weeksOfYear == 52 && weekNumber == 53)) {
            throw new ApiException(400, "Weekly menu not found");
        }
        LocalDate firstDayOfWeek;
        /* If year have 52 weeks but end in next week
         * (it haven't 53 weeks, then some days is in next year) then print 
         * first week of next year with last days of previous year.
         */
        if (weeksOfYear == 53 && weekNumber == 53) { 
            weekNumber = 01;
            year += 1;
        }
         
        
        firstDayOfWeek = new LocalDate().withYear(year).withWeekOfWeekyear(weekNumber);
        firstDayOfWeek = firstDayOfWeek.minusDays(firstDayOfWeek.getDayOfWeek() - 1); 
       
        List<com.jrtechnologies.yum.api.model.DailyMenu> weeklyMenu = new ArrayList<>();
        for (int i = 0; i < 7; i++) {
            DailyMenu dailymenu = createWeekDailyMenu(firstDayOfWeek.plusDays(i), userId);
            if (dailymenu.getDate() != null) {
                weeklyMenu.add(dailymenu);
            }
        }
        return weeklyMenu;
    } else {
        throw new ApiException(400, "Weekly menu not found");
    }
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:43,代碼來源:MenusService.java


注:本文中的org.joda.time.LocalDate.minusDays方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。