当前位置:网站首页>LocalDate加减操作及比较大小
LocalDate加减操作及比较大小
2022-07-31 03:19:00 【UlricaQ】
LocalDate做加减操作,代码及运行结果:
代码:
public void test() {
LocalDate today = LocalDate.now();
System.out.println("today:"+today);
// today加五天
LocalDate plusDays = today.plusDays(5);
System.out.println("today加5天:"+plusDays);
// today减5天
LocalDate minusDays = today.minusDays(5);
System.out.println("today减5天:"+minusDays);
// 判断today是否在plusDays之前,返回布尔值
boolean before = today.isBefore(plusDays);
System.out.println("判断today是否在plusDays之前:"+before);
boolean after = today.isAfter(plusDays);
System.out.println("判断today是否在plusDays之后:"+after);
// 比较today与plusDays,结果返回today-plusDays的值
int i = today.compareTo(plusDays);
System.out.println("today与plusDays比较大小:"+ i);
}
边栏推荐
- 12 Disk related commands
- The els block moves the boundary to the right, and accelerates downward.
- 【CocosCreator 3.5】CocosCreator 获取网络状态
- LeetCode每日一练 —— 138. 复制带随机指针的链表
- 【C语言】表达式求值的一般方法
- LeetCode每日一练 —— OR36 链表的回文结构
- Implementation of a sequence table
- CorelDRAW2022 streamlined Asia Pacific new features in detail
- Crypto Firms Offer Offer To Theft Hackers: Keep A Little, Give The Rest
- return in try-catch
猜你喜欢
随机推荐
LeetCode每日一练 —— OR36 链表的回文结构
Select the smoke test case, and make the first pass for the product package entering QA
C# remote debugging
IDEA 注释报红解决
LeetCode simple problem to find the subsequence of length K with the largest sum
点云DBSCAN聚类(MATLAB,非内置函数)
IIR filter and FIR filter
Redis implements distributed locks
一份高质量的测试用例如何养成?
[Compilation principle] Design principle and implementation of recursive descent parsing
The distance value between two arrays of LeetCode simple questions
The application and practice of mid-to-platform brand advertising platform
els 方块向右移
Automation strategies for legacy systems
大小端模式
Detailed explanation of TCP (3)
Golang中的addressable
A brief introduction to the CheckboxListTile component of the basic components of Flutter
【C语言】表达式求值的一般方法
【AUTOSAR-RTE】-4-Port和Interface以及Data Type

![[Dynamic programming] Maximum sum of consecutive subarrays](/img/3d/10731cc64d1c69d2beb3666ae0f064.png)






![[Android] Room - Alternative to SQLite](/img/52/0bc1c0a3173da6d39224ad8440a462.png)
