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


Java LocalDate.plusMonths方法代码示例

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


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

示例1: getItemSearchStatisticsAsync

import java.time.LocalDate; //导入方法依赖的package包/类
/**
 * 异步获取每日,每周,每月的统计数据
 * @return 统计列表包含每日,每周,每月的统计数据
 */
private List<ItemSearchStatisticDTO> getItemSearchStatisticsAsync() {
    List<ItemSearchStatisticDTO> itemSearchStatisticDTOList = new ArrayList<>(30);
    int size = 10;

    // 每日
    LocalDate todayDate = LocalDate.now();
    Future<List<Object[]>> itemDailySearchStatistics = findDateSearchStatistics(todayDate.toString(), size);
    // 每周
    LocalDate beforeWeekDate = todayDate.plusDays(-7);
    Future<List<Object[]>> itemWeeklySearchStatistics = findDateSearchStatistics(beforeWeekDate.toString(), size);
    // 每月
    LocalDate beforeMonthDate = todayDate.plusMonths(-30);
    Future<List<Object[]>> itemMonthlySearchStatistics = findDateSearchStatistics(beforeMonthDate.toString(), size);
    fillItemSearchStatisticList(itemSearchStatisticDTOList, itemDailySearchStatistics, ItemSearchStatisticDTO.DAILY);
    fillItemSearchStatisticList(itemSearchStatisticDTOList, itemWeeklySearchStatistics, ItemSearchStatisticDTO.WEEKLY);
    fillItemSearchStatisticList(itemSearchStatisticDTOList, itemMonthlySearchStatistics, ItemSearchStatisticDTO.MONTHLY);
    return itemSearchStatisticDTOList;
}
 
开发者ID:liufeng0103,项目名称:bnade-web-ssh,代码行数:23,代码来源:StatisticService.java

示例2: createAuthenticationToken

import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public String createAuthenticationToken(String email) {
    LocalDate currentDate = LocalDate.now();
    LocalDate nextMoth = currentDate.plusMonths(1) ;
    Date date = Date.from(nextMoth.atStartOfDay(ZoneId.systemDefault()).toInstant());
    String jwtToken = Jwts.builder()
            .setSubject(email)
            .setExpiration(date)
            .signWith(
                    SignatureAlgorithm.HS256,
                    SECURET.getBytes()
           )
            .compact();

    DBAuthenticationToken dbAuthenticationToken = new DBAuthenticationToken(email, jwtToken) ;
    tokenMapper.insert(dbAuthenticationToken);
    return jwtToken;
}
 
开发者ID:auslides,项目名称:stateless-shiro,代码行数:19,代码来源:TokenRepositoryImpl.java

示例3: generateProductIncrementName

import java.time.LocalDate; //导入方法依赖的package包/类
private String generateProductIncrementName(int months){
    String pattern = "%1s-%2s";
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd");

    LocalDate now = LocalDate.now();
    LocalDate changeMonthDate = now.plusMonths(months);
    String formattedChangeMonthDate = changeMonthDate.format(formatter);
    String formattedNow = now.format(formatter);

    return months < 0 ?
        String.format(pattern,formattedChangeMonthDate,formattedNow) :
        String.format(pattern,formattedNow ,formattedChangeMonthDate);
}
 
开发者ID:BBVA,项目名称:mirrorgate,代码行数:14,代码来源:ProgramIncrementServiceTest.java

示例4: performAnimalEnrichment

import java.time.LocalDate; //导入方法依赖的package包/类
private static void performAnimalEnrichment(LocalDate start, LocalDate end) {
    LocalDate upTo = start;
    while (upTo.isBefore(end)) {
        System.out.println("give new toy: " + upTo);
        upTo = upTo.plusMonths(1);
    }
}
 
开发者ID:huby,项目名称:java-se8-oca-study-guide,代码行数:8,代码来源:Zoo.java

示例5: test_plusMonths_long_invalidTooLargeMaxAddMax

import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_plusMonths_long_invalidTooLargeMaxAddMax() {
    LocalDate test = LocalDate.of(Year.MAX_VALUE, 12, 1);
    test.plusMonths(Long.MAX_VALUE);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:TCKLocalDate.java

示例6: test_plusMonths_long_invalidTooLargeMaxAddMin

import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_plusMonths_long_invalidTooLargeMaxAddMin() {
    LocalDate test = LocalDate.of(Year.MAX_VALUE, 12, 1);
    test.plusMonths(Long.MIN_VALUE);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:TCKLocalDate.java


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