public class InitTimeUtil extends Object
文件名:InitTimeUtil.java
用途: 提供特殊的更改日期/时间的方法,
编码时间:2021年1月21日上午8:15:45
修改时间:2021年1月21日上午8:15:45
Modifier and Type | Method and Description |
---|---|
static LocalDateTime |
firstDayOfMonth(LocalDateTime date)
更改日期为指定日期下当月的第一天
|
static LocalDateTime |
firstDayOfYear(LocalDateTime date)
更改日期为指定日期下当年的第一天
|
static LocalDateTime |
lastDayOfMonth(boolean isLastTime,
LocalDateTime date)
更改日期为指定日期下当月的最后一天
|
static LocalDateTime |
lastDayOfYear(boolean isLastTime,
LocalDateTime date)
更改日期为指定日期下当年的最后第一天
|
static LocalDateTime |
lastTimeOfDay(LocalDateTime date)
更改日期为指定日期下当天的最后一刻
|
static LocalDateTime |
startHour(int hour,
LocalDateTime date)
更改日期为指定日期下当天的指定的小时数的起始时间
|
static LocalDateTime |
startMinute(int minute,
LocalDateTime date)
更改日期为指定日期下当天的指定的分钟数的起始时间
|
static LocalDateTime |
startTimeOfDay(LocalDateTime date)
更改日期为指定日期下当天的0点
|
public static LocalDateTime firstDayOfYear(LocalDateTime date)
例如,指定时间为:2019-12-21 15:21:10,则调用方法后,将返回时间为:2019-01-01 00:00:00
注意:若日期未传入(null),则默认为当天的日期
date
- 指定的日期public static LocalDateTime lastDayOfYear(boolean isLastTime, LocalDateTime date)
方法允许指定是否将时间也指向最后的日期,例如:
注意:若日期未传入(null),则默认为当天的日期
isLastTime
- 是否指定为最后一刻date
- 指定的日期public static LocalDateTime firstDayOfMonth(LocalDateTime date)
例如,指定时间为:2019-12-21 15:21:10,则调用方法后,将返回时间为:2019-12-01 00:00:00
注意:若日期未传入(null),则默认为当天的日期
date
- 指定的日期public static LocalDateTime lastDayOfMonth(boolean isLastTime, LocalDateTime date)
方法允许指定是否将时间也指向最后的日期,例如:
注意:若日期未传入(null),则默认为当天的日期
isLastTime
- 是否指定为最后一刻date
- 指定的日期public static LocalDateTime startTimeOfDay(LocalDateTime date)
例如,指定时间为:2019-12-21 15:21:10,则调用方法后,将返回时间为:2019-12-21 00:00:00
注意:若日期未传入(null),则默认为当天的日期
date
- 指定的日期public static LocalDateTime lastTimeOfDay(LocalDateTime date)
例如,指定时间为:2019-12-21 15:21:10,则调用方法后,将返回时间为:2019-12-21 23:59:59
注意:若日期未传入(null),则默认为当天的日期
date
- 指定的日期public static LocalDateTime startHour(int hour, LocalDateTime date)
例如,指定时间为:2019-12-21 15:21:10,则调用方法后,将返回时间为:2019-12-21 15:00:00
注意:
hour
- 指定的小时数date
- 指定的日期public static LocalDateTime startMinute(int minute, LocalDateTime date)
例如,指定时间为:2019-12-21 15:21:10,则调用方法后,将返回时间为:2019-12-21 15:21:00
注意:
minute
- 指定的分钟数date
- 指定的日期Copyright © 2024. All rights reserved.