public class DateTimeCalculatorUtil extends Object
averageTime(List<Date> dateList)
,返回平均时间,比如"15:03:03"。Modifier and Type | Method and Description |
---|---|
static LocalTime |
averageTime(List<Date> dateList)
计算平均时间
|
static long |
betweenDays(Date startInclusive,
Date endExclusive)
Deprecated.
|
static long |
betweenDays(LocalDate startInclusive,
LocalDate endExclusive)
Deprecated.
|
static long |
betweenDays(LocalDateTime startInclusive,
LocalDateTime endExclusive)
Deprecated.
|
static long |
betweenMonths(Date startInclusive,
Date endExclusive)
Deprecated.
|
static long |
betweenMonths(LocalDate startInclusive,
LocalDate endExclusive)
Deprecated.
|
static long |
betweenMonths(LocalDateTime startInclusive,
LocalDateTime endExclusive)
Deprecated.
|
static long |
betweenNextSameMonthDay(Date date,
String monthDayStr)
下个固定月日相差天数,用于生日,节日等周期性的日期推算
|
static long |
betweenNextSameMonthDay(LocalDate localDate1,
int month,
int dayOfMonth)
下个固定月日相差天数,用于生日,节日等周期性的日期推算
|
static long |
betweenNextSameMonthDay(LocalDate localDate,
String monthDayStr)
下个固定月日相差天数,用于生日,节日等周期性的日期推算
|
static long |
betweenNextSameMonthDayOfNow(String monthDayStr)
下个固定月日相差天数,与当前日期对比,用于生日,节日等周期性的日期推算
|
static long |
betweenPeriodDays(Date startInclusive,
Date endExclusive)
获取2个日期的相差年月天的天数部分,不是相差总天数,
比如2020-02-29 2021-03-07,返回7
|
static long |
betweenPeriodDays(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差年月天的天数部分,不是相差总天数,
比如2020-02-29 2021-03-07,返回7
|
static long |
betweenPeriodDays(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差年月天的天数部分,不是相差总天数,
比如2020-02-29 2021-03-07,返回7
|
static long |
betweenPeriodMonths(Date startInclusive,
Date endExclusive)
获取2个日期的相差年月天的月数部分,不是相差总月数,
比如2020-02-29 2021-03-07,返回0
|
static long |
betweenPeriodMonths(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差年月天的月数部分,不是相差总月数,
比如2020-02-29 2021-03-07,返回0
|
static long |
betweenPeriodMonths(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差年月天的月数部分,不是相差总月数,
比如2020-02-29 2021-03-07,返回0
|
static long |
betweenPeriodYears(Date startInclusive,
Date endExclusive)
获取2个日期的相差年月天的年数部分,不是相差总年数,
比如2020-02-29 2021-03-07,返回1
|
static long |
betweenPeriodYears(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差年月天的年数部分,不是相差总年数,
比如2020-02-29 2021-03-07,返回1
|
static long |
betweenPeriodYears(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差年月天的年数部分,不是相差总年数,
比如2020-02-29 2021-03-07,返回1
|
static long |
betweenTotalDays(Date startInclusive,
Date endExclusive)
获取2个日期的相差总天数
|
static long |
betweenTotalDays(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差总天数
|
static long |
betweenTotalDays(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总天数
|
static long |
betweenTotalHours(Date startInclusive,
Date endExclusive)
获取2个日期的相差总小时数
|
static long |
betweenTotalHours(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差总小时数
|
static long |
betweenTotalHours(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总小时数
|
static long |
betweenTotalHours(LocalTime startInclusive,
LocalTime endExclusive)
获取2个日期的相差总小时数
|
static long |
betweenTotalMillis(Date startInclusive,
Date endExclusive)
获取2个日期的相差总毫秒数
|
static long |
betweenTotalMillis(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差总毫秒数
|
static long |
betweenTotalMillis(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总毫秒数
|
static long |
betweenTotalMillis(LocalTime startInclusive,
LocalTime endExclusive)
获取2个日期的相差总毫秒数
|
static long |
betweenTotalMinutes(Date startInclusive,
Date endExclusive)
获取2个日期的相差总分钟数
|
static long |
betweenTotalMinutes(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差总分钟数
|
static long |
betweenTotalMinutes(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总分钟数
|
static long |
betweenTotalMinutes(LocalTime startInclusive,
LocalTime endExclusive)
获取2个日期的相差总分钟数
|
static long |
betweenTotalNanos(Date startInclusive,
Date endExclusive)
获取2个日期的相差总纳秒数
|
static long |
betweenTotalNanos(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差总纳秒数
|
static long |
betweenTotalNanos(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总纳秒数
|
static long |
betweenTotalNanos(LocalTime startInclusive,
LocalTime endExclusive)
获取2个日期的相差总纳秒数
|
static long |
betweenTotalSeconds(Date startInclusive,
Date endExclusive)
获取2个日期的相差总秒数
|
static long |
betweenTotalSeconds(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差总秒数
|
static long |
betweenTotalSeconds(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总秒数
|
static long |
betweenTotalSeconds(LocalTime startInclusive,
LocalTime endExclusive)
获取2个日期的相差总秒数
|
static long |
betweenYears(Date startInclusive,
Date endExclusive)
Deprecated.
|
static long |
betweenYears(LocalDate startInclusive,
LocalDate endExclusive)
Deprecated.
|
static long |
betweenYears(LocalDateTime startInclusive,
LocalDateTime endExclusive)
Deprecated.
|
static List<String> |
chineseWorkDay(LocalDate start,
LocalDate end,
String holidayData)
时间段内中国工作日,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static List<String> |
chineseWorkDay(long start,
long end,
String holidayData)
时间段内中国工作日,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static int |
chineseWorkDayCount(long start,
long end,
String holidayData)
时间段内中国工作日天数,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static int |
compare(Date date1,
Date date2)
比较2个时间Date
|
static int |
compare(Temporal temporal1,
Temporal temporal2)
比较2个时间,可用于LocalDateTime,LocalDate,LocalTime,Instant
|
static String |
countdown(Date start,
Date end,
String unitNames)
根据起始时间计算倒计时
|
static String |
countdown(Date start,
String unitNames)
根据传入时间和当前时间计算倒计时
|
static String |
countdown(long millis)
根据毫秒值计算倒计时
|
static String |
countdown(long millis,
String unitNames)
根据毫秒值计算倒计时
|
static String |
countdownWithDay(Date start,
Date end,
String unitNames)
根据起始时间计算倒计时
|
static String |
countdownWithDay(Date start,
String unitNames)
根据传入时间和当前时间计算倒计时
|
static String |
countdownWithDay(long millis)
根据毫秒值计算倒计时,包含天数
|
static String |
countdownWithDay(long millis,
String unitNames)
根据毫秒值计算倒计时,包含天数
|
static Duration |
durationBetween(Temporal startInclusive,
Temporal endExclusive)
获取2个日期的总的天时分秒毫秒纳秒
|
static Date |
endAccuracyTimeOfDate(Date date)
获localDateTime结束时间,精确时间到纳秒 23:59:59.999000000 (转换为Date会丢失毫秒以后数据)
|
static LocalTime |
endAccuracyTimeOfDay()
一天结束时间 精确时间到纳秒 23:59:59.999999999
|
static LocalDateTime |
endAccuracyTimeOfLocalDateTime(LocalDateTime localDateTime)
获取localDateTime结束时间,精确时间到纳秒 23:59:59.999999999
|
static Date |
endTimeOfCurrentQuarter()
获取当前季度结束日期的时间
|
static Date |
endTimeOfCurrentYear()
获取当前年结束日期的时间
|
static Date |
endTimeOfDate(Date date)
获取date结束时间 精确到秒 23:59:59
|
static Date |
endTimeOfDate(int year,
int month,
int dayOfMonth)
获取指定日期的结束时间
|
static LocalTime |
endTimeOfDay()
一天开始时间 23:59:59
|
static Date |
endTimeOfFirstQuarter(int year)
获取第一季度结束日期的开始时间
|
static Date |
endTimeOfFourthQuarter(int year)
获取第四季度结束日期的开始时间
|
static Date |
endTimeOfLastMonth()
上个月最后一天结束时间 即:上个月最后一天日期+23:59:59
|
static Date |
endTimeOfMonth()
当月最后一天结束时间即:当月最后一天日期+23:59:59
|
static Date |
endTimeOfSecondQuarter(int year)
获取第二季度结束日期的开始时间
|
static Date |
endTimeOfSpecialMonth(int year,
int month)
获取指定年月的最后一天结束时间
|
static Date |
endTimeOfThirdQuarter(int year)
获取第三季度结束日期的开始时间
|
static Date |
endTimeOfToday()
今天结束时间即:今天日期+23:59:59
|
static Date |
endTimeOfTomorrow()
明天结束时间即:明天日期+23:59:59
|
static Date |
endTimeOfYear(int year)
获取指定年结束日期的开始时间
|
static Date |
endTimeOfYesterday()
昨天结束时间即:昨天日期+23:59:59
|
static Date |
firstDayOfMonth(Date date)
获取当前月的第一天
|
static LocalDate |
firstDayOfMonth(LocalDate localDate)
获取当前月的第一天
|
static LocalDateTime |
firstDayOfMonth(LocalDateTime localDateTime)
获取当前月的第一天
|
static int |
getAge(Date birthDay)
计算年龄
|
static int |
getAge(LocalDate birthDay)
计算年龄
|
static int |
getAge(LocalDateTime birthDay)
计算年龄
|
static String |
getConstellationNameCn(Date date)
根据日期查询星座中文名称
|
static String |
getConstellationNameCn(String monthDayStr)
根据日期查询星座中文名称
|
static String |
getConstellationNameEn(String monthDayStr)
根据日期查询星座英文名称
|
static Date |
getDate(int year,
int month,
int dayOfMonth)
根据年月日创建Date,时间部分为:00:00:00
|
static Date |
getDate(int year,
int month,
int dayOfMonth,
int hour,
int minute,
int second)
根据年月日时分秒创建Date
|
static Date |
getDate(int year,
int month,
int dayOfMonth,
int hour,
int minute,
int second,
int milliOfSecond)
根据年月日时分秒毫秒创建Date
|
static Date |
getDateEndOfMonth(int year,
int month)
获取指定月最后一天
|
static List<String> |
getDateFormatList(Date start,
Date end,
String dateFormatPattern)
获取指定区间的格式化时间列表,包含起始
|
static List<Date> |
getDateList(Date start,
Date end)
获取指定区间的时间列表,包含起始
|
static List<Date> |
getDateList(Date startInclusive,
Date endInclusive,
ChronoUnit unit)
获取指定区间的时间列表,包含起始,间隔指定单位的相同时间
|
static List<Date> |
getDateList(int year,
int month)
获取指定年月的所有日期列表
|
static List<Date> |
getDateList(String yearMonthStr)
获取指定年月的所有日期列表
|
static Date |
getDateStartOfMonth(int year,
int month)
获取指定月第一天
|
static int |
getDayOfMonth(Date date)
获取天
|
static int |
getDayOfMonth(Instant instant)
获取天
|
static int |
getDayOfMonth(LocalDate localDate)
获取天
LocalDateTime LocalDate ZonedDateTime 可以直接.getDayOfMonth()
|
static int |
getDayOfMonth(LocalDateTime localDateTime)
获取天
LocalDateTime LocalDate ZonedDateTime 可以直接.getDayOfMonth()
|
static int |
getDayOfWeek(Date date)
获取星期值 1-7,星期一到星期日
|
static int |
getDayOfWeek(Instant instant)
获取星期值 1-7,星期一到星期日
|
static int |
getDayOfWeek(LocalDate localDate)
获取星期值 1-7,星期一到星期日
|
static int |
getDayOfWeek(LocalDateTime localDateTime)
获取星期值 1-7,星期一到星期日
|
static String |
getDayOfWeekCn(Date date)
获取星期中文,比如星期一
|
static String |
getDayOfWeekCn(Instant instant)
获取星期中文,比如星期一
|
static String |
getDayOfWeekCn(LocalDate localDate)
获取星期中文,比如星期一
|
static String |
getDayOfWeekCn(LocalDateTime localDateTime)
获取星期中文,比如星期一
|
static String |
getDayOfWeekCnShort(Date date)
获取星期中文简称,比如星期一为一
|
static String |
getDayOfWeekCnShort(Instant instant)
获取星期中文简称,比如星期一为一
|
static String |
getDayOfWeekCnShort(LocalDate localDate)
获取星期中文简称,比如星期一为一
|
static String |
getDayOfWeekCnShort(LocalDateTime localDateTime)
获取星期中文简称,比如星期一为一
|
static String |
getDayOfWeekEnLong(Date date)
获取星期英文全称,比如Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday
|
static String |
getDayOfWeekEnLong(Instant instant)
获取星期英文全称,比如Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday
|
static String |
getDayOfWeekEnLong(LocalDate localDate)
获取星期英文全称,比如Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday
|
static String |
getDayOfWeekEnLong(LocalDateTime localDateTime)
获取星期英文全称,比如Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday
|
static String |
getDayOfWeekEnShort(Date date)
获取星期英文简称,比如Mon
|
static String |
getDayOfWeekEnShort(Instant instant)
获取星期英文简称,比如Mon
|
static String |
getDayOfWeekEnShort(LocalDate localDate)
获取星期英文简称,比如Mon
|
static String |
getDayOfWeekEnShort(LocalDateTime localDateTime)
获取星期英文简称,比如Mon
|
static String |
getDayOfWeekEnShortUpper(Date date)
获取星期英文简称大写,比如MON
|
static String |
getDayOfWeekEnShortUpper(Instant instant)
获取星期英文简称大写,比如MON
|
static String |
getDayOfWeekEnShortUpper(LocalDate localDate)
获取星期英文简称大写,比如MON
|
static String |
getDayOfWeekEnShortUpper(LocalDateTime localDateTime)
获取星期英文简称大写,比如MON
|
static int |
getDayOfYear()
获取当前时间在一年中的第几天
|
static int |
getDayOfYear(Date date)
获取天(一年中)
|
static int |
getDayOfYear(Instant instant)
获取天(一年中)
|
static int |
getDayOfYear(LocalDate localDate)
获取天(一年中)
LocalDateTime LocalDate ZonedDateTime 可以直接.getDayOfYear()获取
|
static int |
getDayOfYear(LocalDateTime localDateTime)
获取天(一年中)
LocalDateTime LocalDate ZonedDateTime 可以直接.getDayOfYear()获取
|
static long |
getEpochMilli()
获取时间戳
|
static String |
getEpochMilliFormat()
获取格式化时间戳字符串
|
static String |
getEpochMilliFormatFull()
获取格式化时间戳字符串,带毫秒
|
static String |
getEpochMilliIsoFormat()
获取格式化时间戳字符串 iso格式 带: 2020-02-18T22:37:55+08:00
|
static String |
getEpochMilliIsoFormatFull()
获取格式化时间戳字符串 iso格式 带毫秒 带: 2020-02-18T22:37:55.991+08:00
|
static String |
getEpochMilliIsoFormatFullNoColon()
获取格式化时间戳字符串 iso格式 带毫秒 2020-02-18T22:37:55.991+0800
|
static String |
getEpochMilliIsoNotFormatNoColon()
获取格式化时间戳字符串 iso格式 2020-02-18T22:37:55+0800
|
static long |
getEpochSecond()
获取时间戳(到秒)
|
static int |
getHour(Date date)
获取小时
|
static int |
getHour(Instant instant)
获取小时
|
static int |
getHour(LocalDateTime localDateTime)
获取小时
LocalDateTime LocalTime ZonedDateTime 可以直接.getHour()获取
|
static int |
getHour(LocalTime localTime)
获取小时
LocalDateTime LocalTime ZonedDateTime 可以直接.getHour()获取
|
static int |
getLengthOfYear(int year)
获取某年的总天数
|
static List<LocalDate> |
getLocalDateList(int year,
int month)
获取指定年月的所有日期列表
|
static List<LocalDate> |
getLocalDateList(LocalDate start,
LocalDate end)
获取指定区间的时间列表,包含起始
|
static List<LocalDate> |
getLocalDateList(LocalDate start,
LocalDate end,
ChronoUnit unit)
获取指定区间的时间列表,包含起始,间隔指定单位的相同时间
|
static List<LocalDate> |
getLocalDateList(String yearMonthStr)
获取指定年月的所有日期列表
|
static List<LocalDate> |
getLocalDateList(YearMonth yearMonth)
获取指定年月的所有日期列表
|
static List<String> |
getLocalDateTimeFormatList(LocalDateTime start,
LocalDateTime end,
String dateFormatPattern)
获取指定区间的格式化时间列表,包含起始
|
static List<LocalDateTime> |
getLocalDateTimeList(int year,
int month)
获取指定年月的所有日期列表
|
static List<LocalDateTime> |
getLocalDateTimeList(LocalDateTime start,
LocalDateTime end)
获取指定区间的时间列表,包含起始
|
static List<LocalDateTime> |
getLocalDateTimeList(LocalDateTime start,
LocalDateTime end,
ChronoUnit unit)
获取指定区间的时间列表,包含起始,间隔指定单位的相同时间
|
static List<LocalDateTime> |
getLocalDateTimeList(String yearMonthStr)
获取指定年月的所有日期列表
|
static List<LocalDateTime> |
getLocalDateTimeList(YearMonth yearMonth)
获取指定年月的所有日期列表
|
static int |
getMillisecond(Date date)
获取毫秒
|
static int |
getMillisecond(Instant instant)
获取毫秒
|
static int |
getMillisecond(LocalDateTime localDateTime)
获取毫秒
|
static int |
getMillisecond(LocalTime localTime)
获取毫秒
|
static int |
getMillisecond(ZonedDateTime zonedDateTime)
获取毫秒
|
static int |
getMinute(Date date)
获取分钟
|
static int |
getMinute(Instant instant)
获取分钟
|
static int |
getMinute(LocalDateTime localDateTime)
获取分钟
LocalDateTime LocalTime ZonedDateTime 可以直接.getMinute()获取
|
static int |
getMinute(LocalTime localTime)
获取分钟
LocalDateTime LocalTime ZonedDateTime 可以直接.getMinute()获取
|
static int |
getMonth(Date date)
获取月, 比如 1
|
static int |
getMonth(Instant instant)
获取月, 比如 1
|
static int |
getMonth(LocalDate localDate)
获取月, 比如 1
LocalDateTime LocalDate ZonedDateTime 可以直接getMonthValue()
|
static int |
getMonth(LocalDateTime localDateTime)
获取月, 比如 1
LocalDateTime LocalDate ZonedDateTime 可以直接getMonthValue()
|
static String |
getMonthCnLong(Date date)
获取月份中文全称, 比如一月
|
static String |
getMonthCnLong(Instant instant)
获取月份中文全称, 比如一月
|
static String |
getMonthCnLong(LocalDate localDate)
获取月份中文全称, 比如一月
|
static String |
getMonthCnLong(LocalDateTime localDateTime)
获取月份中文全称, 比如一月
|
static String |
getMonthCnShort(Date date)
获取月份中文简称, 比如一
|
static String |
getMonthCnShort(Instant instant)
获取月份中文简称, 比如一
|
static String |
getMonthCnShort(LocalDate localDate)
获取月份中文简称, 比如一
|
static String |
getMonthCnShort(LocalDateTime localDateTime)
获取月份中文简称, 比如一
|
static String |
getMonthEnLong(Date date)
获取月英文全称, 比如 January
|
static String |
getMonthEnLong(Instant instant)
获取月英文全称, 比如 January
|
static String |
getMonthEnLong(LocalDate localDate)
获取月英文全称, 比如 January
|
static String |
getMonthEnLong(LocalDateTime localDateTime)
获取月英文全称, 比如 January
|
static String |
getMonthEnShort(Date date)
获取月英文简称, 比如 Jan
|
static String |
getMonthEnShort(Instant instant)
获取月英文简称, 比如 Jan
|
static String |
getMonthEnShort(LocalDate localDate)
获取月英文简称, 比如 Jan
|
static String |
getMonthEnShort(LocalDateTime localDateTime)
获取月英文简称, 比如 Jan
|
static String |
getMonthEnShortUpper(Date date)
获取月英文简称大写, 比如 JAN
|
static String |
getMonthEnShortUpper(Instant instant)
获取月英文简称大写, 比如 JAN
|
static String |
getMonthEnShortUpper(LocalDate localDate)
获取月英文简称大写, 比如 JAN
|
static String |
getMonthEnShortUpper(LocalDateTime localDateTime)
获取月英文简称大写, 比如 JAN
|
static int |
getQuarter(Date date)
获得季度值
|
static int |
getQuarter(LocalDate localDate)
获得季度值
|
static int |
getQuarter(LocalDateTime localDateTime)
获得季度值
|
static int |
getQuarterOfNow()
获得当前季度值
|
static int |
getSecond(Date date)
获取秒
|
static int |
getSecond(Instant instant)
获取秒
|
static int |
getSecond(LocalDateTime localDateTime)
获取秒
LocalDateTime LocalTime ZonedDateTime 可以直接.getSecond()获取
|
static int |
getSecond(LocalTime localTime)
获取秒
LocalDateTime LocalTime ZonedDateTime 可以直接.getSecond()获取
|
static String |
getTwelveTwo()
获取当前时间对应的十二时辰
|
static String |
getTwelveTwo(Date date)
获取指定时间对应的十二时辰
|
static String |
getTwelveTwo(LocalDateTime localDateTime)
获取指定时间对应的十二时辰
|
static String |
getTwelveTwo(LocalTime localTime)
获取指定时间对应的十二时辰
|
static int |
getYear(Date date)
获取年,比如2020
|
static int |
getYear(Instant instant)
获取年,比如2020
|
static int |
getYear(LocalDate localDate)
获取年,比如2020
LocalDateTime LocalDate ZonedDateTime 可以直接getYear()
|
static int |
getYear(LocalDateTime localDateTime)
获取年,比如2020
LocalDateTime LocalDate ZonedDateTime 可以直接getYear()
|
static ZonedDateTime |
getZonedDateTimeNow(String zoneId)
获取时区当前时间
|
static ZonedDateTime |
getZonedDateTimeNowOfDefault()
获取当前系统当前时区时间
|
static ZonedDateTime |
getZonedDateTimeNowOfEST()
获取当前美国东部标准时区
|
static ZonedDateTime |
getZonedDateTimeNowOfParis()
获取当前巴黎时区时间
|
static ZonedDateTime |
getZonedDateTimeNowOfShanghai()
获取当前上海时区时间(北京时间)
|
static ZonedDateTime |
getZonedDateTimeNowOfTokyo()
获取当前东京时区时间
|
static boolean |
hasChineseWorkDay(Date start,
Date end,
String holidayData)
判断时间段是否包含工作日,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static boolean |
hasChineseWorkDay(LocalDate start,
LocalDate end,
String holidayData)
判断时间段是否包含工作日,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static boolean |
hasChineseWorkDay(long start,
long end,
String holidayData)
判断时间段是否包含工作日,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static boolean |
hasChineseWorkDay(String start,
String end,
String holidayData)
判断时间段是否包含工作日,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static boolean |
isBirthDay(Date birthDay)
是否为生日
|
static boolean |
isBirthDay(LocalDate birthDay)
是否为生日
|
static boolean |
isBirthDay(LocalDateTime birthDay)
是否为生日
|
static boolean |
isChineseWorkDay(Date date,
String holidayData)
判断是否中国工作日,包含法定节假日调整日期,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static boolean |
isChineseWorkDay(LocalDate localDate,
String holidayData)
判断是否中国工作日,包含法定节假日调整日期,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static boolean |
isChineseWorkDay(LocalDateTime localDateTime,
String holidayData)
判断是否中国工作日,包含法定节假日调整日期,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static boolean |
isExpiry(String yearMonthStr)
判断是否过期,(输入年月小于当前年月)
|
static boolean |
isExpiry(YearMonth yearMonth)
判断是否过期,(输入年月小于当前年月)
|
static boolean |
isFriday(Date date)
是否为周五
|
static boolean |
isFriday(LocalDate localDate)
是否为周五
|
static boolean |
isLeapYear(Date date)
判断是否闰年
|
static boolean |
isLeapYear(int year)
判断是否闰年
|
static boolean |
isLeapYear(LocalDate localDate)
判断是否闰年
|
static boolean |
isLeapYear(LocalDateTime localDateTime)
判断是否闰年
|
static boolean |
isMonday(Date date)
是否为周一
|
static boolean |
isMonday(LocalDate localDate)
是否为周一
|
static boolean |
isOverlap(Date startDate1,
Date endDate1,
Date startDate2,
Date endDate2)
判断2个时间段是否有重叠(交集),不严格模式,首尾相等不等于重叠
|
static boolean |
isOverlap(Date startDate1,
Date endDate1,
Date startDate2,
Date endDate2,
boolean isStrict)
判断2个时间段是否有重叠(交集)
|
static boolean |
isOverlap(List<TimePair> timePairList,
boolean isStrict)
判断多个时间段是否有重叠(交集)
|
static boolean |
isOverlap(LocalDate startDate1,
LocalDate endDate1,
LocalDate startDate2,
LocalDate endDate2,
boolean isStrict)
判断2个时间段是否有重叠(交集)
|
static boolean |
isOverlap(LocalDateTime startDate1,
LocalDateTime endDate1,
LocalDateTime startDate2,
LocalDateTime endDate2,
boolean isStrict)
判断2个时间段是否有重叠(交集)
|
static boolean |
isOverlap(long startDate1,
long endDate1,
long startDate2,
long endDate2,
boolean isStrict)
判断2个时间段是否有重叠(交集)
|
static boolean |
isOverlap(TimePair[] timePairs,
boolean isStrict)
判断多个时间段是否有重叠(交集)
|
static boolean |
isSameMonthDay(Date date1,
Date date2)
相同月日比较判断,用于生日,节日等周期性的日期比较判断。
|
static boolean |
isSameMonthDay(Date date,
String monthDayStr)
相同月日比较判断,用于生日,节日等周期性的日期比较判断。
|
static boolean |
isSameMonthDay(LocalDate localDate1,
LocalDate localDate2)
相同月日比较判断,用于生日,节日等周期性的日期比较判断。
|
static boolean |
isSameMonthDay(LocalDate localDate1,
MonthDay monthDay)
相同月日比较判断,用于生日,节日等周期性的日期比较判断。
|
static boolean |
isSameMonthDay(LocalDate localDate1,
String monthDayStr)
相同月日比较判断,用于生日,节日等周期性的日期比较判断。
|
static boolean |
isSameMonthDayOfNow(String monthDayStr)
相同月日比较判断,与当前日期对比,用于生日,节日等周期性的日期比较判断
|
static boolean |
isWeekend(Date date)
判断是否周末(周六周日)
|
static boolean |
isWeekend(LocalDate localDate)
判断是否周末(周六周日)
|
static boolean |
isWeekend(LocalDateTime localDateTime)
判断是否周末(周六周日)
|
static boolean |
isWorkDay(Date date)
判断是否工作日 (周一到周五)
|
static boolean |
isWorkDay(LocalDate localDate)
判断是否工作日 (周一到周五)
|
static boolean |
isWorkDay(LocalDateTime localDateTime)
判断是否工作日 (周一到周五)
|
static boolean |
isZhouWu(Date date)
是否为周五
|
static boolean |
isZhouWu(LocalDate localDate)
是否为周五
|
static boolean |
isZhouYi(Date date)
是否为周一
|
static boolean |
isZhouYi(LocalDate localDate)
是否为周一
|
static Date |
lastDayOfMonth(Date date)
获取当前月的最后一天
|
static LocalDate |
lastDayOfMonth(LocalDate localDate)
获取当前月的最后一天
|
static LocalDateTime |
lastDayOfMonth(LocalDateTime localDateTime)
获取当前月的最后一天
|
static Date |
lastMonth()
上月
|
static Date |
lastWeek()
上周
|
static Date |
lastYear()
去年
|
static int |
lengthOfMonth(Date date)
获取月的天数
|
static int |
lengthOfMonth(LocalDate localDate)
获取月的天数
|
static int |
lengthOfMonth(LocalDateTime localDateTime)
获取月的天数
|
static int |
lengthOfYear(Date date)
获取年的天数
|
static int |
lengthOfYear(LocalDate localDate)
获取年的天数
|
static int |
lengthOfYear(LocalDateTime localDateTime)
获取年的天数
|
static Date |
minus(Date date,
TemporalUnit unit,
long amountToSubtract)
date日期减操作
|
static Temporal |
minus(Temporal temporal,
TemporalUnit unit,
long amountToSubtract)
日期减操作
|
static Date |
minusDays(Date date,
long amountToSubtract)
减天
|
static LocalDate |
minusDays(LocalDate localDate,
long amountToSubtract)
减天
|
static LocalDateTime |
minusDays(LocalDateTime localDateTime,
long amountToSubtract)
减天
|
static Date |
minusHours(Date date,
long amountToSubtract)
减小时
|
static LocalDateTime |
minusHours(LocalDateTime localDateTime,
long amountToSubtract)
减小时
|
static LocalTime |
minusHours(LocalTime localTime,
long amountToSubtract)
减小时
|
static Date |
minusMillis(Date date,
long amountToSubtract)
减毫秒
|
static LocalDateTime |
minusMillis(LocalDateTime localDateTime,
long amountToSubtract)
减毫秒
|
static LocalTime |
minusMillis(LocalTime localTime,
long amountToSubtract)
减毫秒
|
static Date |
minusMinutes(Date date,
long amountToSubtract)
减分钟
|
static LocalDateTime |
minusMinutes(LocalDateTime localDateTime,
long amountToSubtract)
减分钟
|
static LocalTime |
minusMinutes(LocalTime localTime,
long amountToSubtract)
减分钟
|
static Date |
minusMonths(Date date,
long amountToSubtract)
减月
|
static LocalDate |
minusMonths(LocalDate localDate,
long amountToSubtract)
减月
|
static LocalDateTime |
minusMonths(LocalDateTime localDateTime,
long amountToSubtract)
减月
|
static Date |
minusSeconds(Date date,
long amountToSubtract)
减秒
|
static LocalDateTime |
minusSeconds(LocalDateTime localDateTime,
long amountToSubtract)
减秒
|
static LocalTime |
minusSeconds(LocalTime localTime,
long amountToSubtract)
减秒
|
static Date |
minusWeeks(Date date,
long amountToSubtract)
减星期
|
static LocalDate |
minusWeeks(LocalDate localDate,
long amountToSubtract)
减星期
|
static LocalDateTime |
minusWeeks(LocalDateTime localDateTime,
long amountToSubtract)
减星期
|
static Date |
minusYears(Date date,
long amountToSubtract)
减年
|
static LocalDate |
minusYears(LocalDate localDate,
long amountToSubtract)
减年
|
static LocalDateTime |
minusYears(LocalDateTime localDateTime,
long amountToSubtract)
减年
|
static Date |
next(Date date,
DayOfWeek dayOfWeek)
下一个星期几
|
static LocalDate |
next(LocalDate localDate,
DayOfWeek dayOfWeek)
下一个星期几
|
static LocalDateTime |
next(LocalDateTime localDateTime,
DayOfWeek dayOfWeek)
下一个星期几
|
static Date |
nextChineseWorkDay(Date date,
String holidayData)
下一个中国工作日,包含法定节假日调整日期,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static LocalDate |
nextChineseWorkDay(LocalDate localDate,
String holidayData)
下一个中国工作日,包含法定节假日调整日期,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static LocalDateTime |
nextChineseWorkDay(LocalDateTime localDateTime,
String holidayData)
下一个中国工作日,包含法定节假日调整日期,节假日数据holidayData,如果节假日数据不支持年份,将使用周一到周五为工作日来判断。
|
static Date |
nextLeapYear(Date date)
下一个闰年
|
static int |
nextLeapYear(int year)
下一个闰年
|
static LocalDate |
nextLeapYear(LocalDate localDate)
下一个闰年
|
static LocalDateTime |
nextLeapYear(LocalDateTime localDateTime)
下一个闰年
|
static Date |
nextMonth()
下月
|
static Date |
nextSameMonthDay(Date date,
String monthDayStr)
下个固定月日相差日期,用于生日,节日等周期性的日期推算
|
static LocalDate |
nextSameMonthDay(LocalDate localDate,
String monthDayStr)
下个固定月日相差日期,用于生日,节日等周期性的日期推算
|
static Date |
nextSameMonthDayOfNow(String monthDayStr)
下个固定月日相差日期,与当前日期对比,用于生日,节日等周期性的日期推算
|
static Date |
nextWeek()
下周
|
static Date |
nextWorkDay(Date date)
获下一个工作日
|
static LocalDate |
nextWorkDay(LocalDate localDate)
获下一个工作日
|
static LocalDateTime |
nextWorkDay(LocalDateTime localDateTime)
获下一个工作日
|
static Date |
nextYear()
明年
|
static long |
overlapTime(Date startDate1,
Date endDate1,
Date startDate2,
Date endDate2)
计算2个时间段的重叠(交集)时间
|
static long |
overlapTime(long startDate1,
long endDate1,
long startDate2,
long endDate2)
计算2个时间段的重叠(交集)时间
|
static Period |
periodBetween(LocalDate startDateInclusive,
LocalDate endDateExclusive)
获取2个日期的相差年月日部分属性
|
static Date |
plus(Date date,
TemporalUnit unit,
long amountToAdd)
date日期加操作
|
static Temporal |
plus(Temporal temporal,
TemporalUnit unit,
long amountToAdd)
日期加操作
|
static Date |
plusDays(Date date,
long amountToAdd)
加天
|
static LocalDate |
plusDays(LocalDate localDate,
long amountToAdd)
加天
|
static LocalDateTime |
plusDays(LocalDateTime localDateTime,
long amountToAdd)
加天
|
static Date |
plusHours(Date date,
long amountToAdd)
加小时
|
static LocalDateTime |
plusHours(LocalDateTime localDateTime,
long amountToAdd)
加小时
|
static LocalTime |
plusHours(LocalTime localTime,
long amountToAdd)
加小时
|
static Date |
plusMillis(Date date,
long amountToAdd)
增加毫秒
|
static LocalDateTime |
plusMillis(LocalDateTime localDateTime,
long amountToAdd)
增加毫秒
|
static LocalTime |
plusMillis(LocalTime localTime,
long amountToAdd)
增加毫秒
|
static Date |
plusMinutes(Date date,
long amountToAdd)
加分钟
|
static LocalDateTime |
plusMinutes(LocalDateTime localDateTime,
long amountToAdd)
加分钟
|
static LocalTime |
plusMinutes(LocalTime localTime,
long amountToAdd)
加分钟
|
static Date |
plusMonths(Date date,
long amountToAdd)
加月
|
static LocalDate |
plusMonths(LocalDate localDate,
long amountToAdd)
加月
|
static LocalDateTime |
plusMonths(LocalDateTime localDateTime,
long amountToAdd)
加月
|
static Date |
plusSeconds(Date date,
long amountToAdd)
加秒
|
static LocalDateTime |
plusSeconds(LocalDateTime localDateTime,
long amountToAdd)
加秒
|
static LocalTime |
plusSeconds(LocalTime localTime,
long amountToAdd)
加秒
|
static Date |
plusWeeks(Date date,
long amountToAdd)
加星期
|
static LocalDate |
plusWeeks(LocalDate localDate,
long amountToAdd)
加星期
|
static LocalDateTime |
plusWeeks(LocalDateTime localDateTime,
long amountToAdd)
加星期
|
static Date |
plusYears(Date date,
long amountToAdd)
加年
|
static LocalDate |
plusYears(LocalDate localDate,
long amountToAdd)
加年
|
static LocalDateTime |
plusYears(LocalDateTime localDateTime,
long amountToAdd)
加年
|
static Date |
previous(Date date,
DayOfWeek dayOfWeek)
上一个星期几
|
static LocalDate |
previous(LocalDate localDate,
DayOfWeek dayOfWeek)
上一个星期几
|
static LocalDateTime |
previous(LocalDateTime localDateTime,
DayOfWeek dayOfWeek)
上一个星期几
|
static Date |
reduceAccuracyToDay(Date date)
减少时间精度到天,其他补0,返回如,2020-04-23 00:00:00
|
static LocalDateTime |
reduceAccuracyToDay(LocalDateTime localDateTime)
减少时间精度到天,其他补0,返回如,2020-04-23 00:00:00
|
static Date |
reduceAccuracyToHour(Date date)
减少时间精度到小时,其他补0,返回如,2020-04-23 15:00:00
|
static LocalDateTime |
reduceAccuracyToHour(LocalDateTime localDateTime)
减少时间精度到小时,其他补0,返回如,2020-04-23 15:00:00
|
static Date |
reduceAccuracyToMinute(Date date)
减少时间精度到分,其他补0,返回如,2020-04-23 15:18:00
|
static LocalDateTime |
reduceAccuracyToMinute(LocalDateTime localDateTime)
减少时间精度到分,其他补0,返回如,2020-04-23 15:18:00
|
static Date |
reduceAccuracyToSecond(Date date)
减少时间精度到秒,其他补0,返回如,2020-04-23 15:18:13
|
static LocalDateTime |
reduceAccuracyToSecond(LocalDateTime localDateTime)
减少时间精度到秒,其他补0,返回如,2020-04-23 15:18:13
|
static Date |
startTimeOfCurrentQuarter()
获取当前季度起始日期的开始时间
|
static Date |
startTimeOfCurrentYear()
获取当前年起始日期的开始时间
|
static Date |
startTimeOfDate(Date date)
获date起始时间
|
static Date |
startTimeOfDate(int year,
int month,
int dayOfMonth)
获取指定日期的起始时间
|
static LocalTime |
startTimeOfDay()
一天开始时间 00:00:00
|
static Date |
startTimeOfFirstQuarter(int year)
获取第一季度起始日期的开始时间
|
static Date |
startTimeOfFourthQuarter(int year)
获取第四季度起始日期的开始时间
|
static Date |
startTimeOfLastMonth()
上个月第一天起始时间 即:上个月第一天日期+00:00:00
|
static LocalDateTime |
startTimeOfLocalDateTime(LocalDateTime localDateTime)
获localDateTime起始时间
|
static Date |
startTimeOfMonth()
当月第一天起始时间 即:当月第一天日期+00:00:00
|
static Date |
startTimeOfSecondQuarter(int year)
获取第二季度起始日期的开始时间
|
static Date |
startTimeOfSpecialMonth(int year,
int month)
获取指定年月的第一天起始时间
|
static Date |
startTimeOfThirdQuarter(int year)
获取第三季度起始日期的开始时间
|
static Date |
startTimeOfToday()
今天起始时间 即:今天日期+00:00:00
|
static Date |
startTimeOfTomorrow()
明天起始时间 即:明天日期+00:00:00
|
static Date |
startTimeOfYear(int year)
获取指定年起始日期的开始时间
|
static Date |
startTimeOfYesterday()
昨天起始时间 即:昨天日期+00:00:00
|
static Date |
today()
今天
|
static Date |
tomorrow()
明天
|
static String |
transform(Date date,
String zoneId)
时区转换计算
|
static String |
transform(Date date,
ZoneId zone)
时区转换计算
|
static ZonedDateTime |
transform(ZonedDateTime zonedDateTime,
String zoneId)
时区转换计算
|
static ZonedDateTime |
transform(ZonedDateTime zonedDateTime,
ZoneId zone)
时区转换计算
|
static int |
weekOfMonth()
当前日期所在月中第几周
|
static int |
weekOfMonth(Date date)
日期所在月中第几周
|
static int |
weekOfMonth(LocalDate localDate)
日期所在月中第几周
|
static int |
weekOfMonth(LocalDate localDate,
Locale locale)
日期所在月中第几周
|
static int |
weekOfMonth(LocalDateTime localDateTime)
日期所在月中第几周
|
static int |
weekOfYear()
当前日期所在年中第几周
|
static int |
weekOfYear(Date date)
日期所在年中第几周
|
static int |
weekOfYear(LocalDate localDate)
日期所在年中第几周
|
static int |
weekOfYear(LocalDate localDate,
Locale locale)
日期所在年中第几周
|
static int |
weekOfYear(LocalDateTime localDateTime)
日期所在年中第几周
|
static Date |
with(Date date,
TemporalField field,
long newValue)
根据field修改属性
|
static Temporal |
with(Temporal temporal,
TemporalField field,
long newValue)
根据field修改属性
|
static Date |
withDayOfMonth(Date date,
long newValue)
修改天
|
static LocalDate |
withDayOfMonth(LocalDate localDate,
long newValue)
修改天
|
static LocalDateTime |
withDayOfMonth(LocalDateTime localDateTime,
long newValue)
修改天
|
static Date |
withDayOfWeek(Date date,
long newValue)
修改星期
|
static LocalDate |
withDayOfWeek(LocalDate localDate,
long newValue)
修改星期
|
static LocalDateTime |
withDayOfWeek(LocalDateTime localDateTime,
long newValue)
修改星期
|
static Date |
withDayOfYear(Date date,
long newValue)
修改一年中的天
|
static LocalDate |
withDayOfYear(LocalDate localDate,
long newValue)
修改一年中的天
|
static LocalDateTime |
withDayOfYear(LocalDateTime localDateTime,
long newValue)
修改一年中的天
|
static Date |
withHour(Date date,
long newValue)
修改小时
|
static LocalDateTime |
withHour(LocalDateTime localDateTime,
long newValue)
修改小时
|
static LocalTime |
withHour(LocalTime localTime,
long newValue)
修改小时
|
static Date |
withMilli(Date date,
long newValue)
修改毫秒
|
static LocalDateTime |
withMilli(LocalDateTime localDateTime,
long newValue)
修改毫秒
|
static LocalTime |
withMilli(LocalTime localTime,
long newValue)
修改毫秒
|
static Date |
withMinute(Date date,
long newValue)
修改分钟
|
static LocalDateTime |
withMinute(LocalDateTime localDateTime,
long newValue)
修改分钟
|
static LocalTime |
withMinute(LocalTime localTime,
long newValue)
修改分钟
|
static Date |
withMonth(Date date,
long newValue)
修改月
|
static LocalDate |
withMonth(LocalDate localDate,
long newValue)
修改月
|
static LocalDateTime |
withMonth(LocalDateTime localDateTime,
long newValue)
修改月
|
static Date |
withSecond(Date date,
long newValue)
修改秒
|
static LocalDateTime |
withSecond(LocalDateTime localDateTime,
long newValue)
修改秒
|
static LocalTime |
withSecond(LocalTime localTime,
long newValue)
修改秒
|
static Date |
withYear(Date date,
long newValue)
修改年
|
static LocalDate |
withYear(LocalDate localDate,
long newValue)
修改年
|
static LocalDateTime |
withYear(LocalDateTime localDateTime,
long newValue)
修改年
|
static Date |
yesterday()
昨天
|
public static int getYear(Date date)
date
- Datepublic static int getYear(Instant instant)
instant
- Instantpublic static int getYear(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getYear(LocalDate localDate)
localDate
- localDatepublic static int getMonth(Date date)
date
- Datepublic static int getMonth(Instant instant)
instant
- Instantpublic static int getMonth(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getMonth(LocalDate localDate)
localDate
- LocalDatepublic static String getMonthEnLong(Date date)
date
- Datepublic static String getMonthEnLong(Instant instant)
instant
- Instantpublic static String getMonthEnLong(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getMonthEnLong(LocalDate localDate)
localDate
- LocalDatepublic static String getMonthEnShort(Date date)
date
- Datepublic static String getMonthEnShort(Instant instant)
instant
- Instantpublic static String getMonthEnShort(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getMonthEnShort(LocalDate localDate)
localDate
- LocalDatepublic static String getMonthEnShortUpper(Date date)
date
- Datepublic static String getMonthEnShortUpper(Instant instant)
instant
- Instantpublic static String getMonthEnShortUpper(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getMonthEnShortUpper(LocalDate localDate)
localDate
- LocalDatepublic static String getMonthCnLong(Date date)
date
- Datepublic static String getMonthCnLong(Instant instant)
instant
- Instantpublic static String getMonthCnLong(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getMonthCnLong(LocalDate localDate)
localDate
- LocalDatepublic static String getMonthCnShort(Date date)
date
- Datepublic static String getMonthCnShort(Instant instant)
instant
- Instantpublic static String getMonthCnShort(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getMonthCnShort(LocalDate localDate)
localDate
- LocalDatepublic static int getDayOfMonth(Date date)
date
- Datepublic static int getDayOfMonth(Instant instant)
instant
- Instantpublic static int getDayOfMonth(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getDayOfMonth(LocalDate localDate)
localDate
- localDatepublic static int getDayOfYear(Date date)
date
- Datepublic static int getDayOfYear(Instant instant)
instant
- Instantpublic static int getDayOfYear(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getDayOfYear(LocalDate localDate)
localDate
- localDatepublic static int getLengthOfYear(int year)
year
- 年public static int getDayOfYear()
public static int getHour(Date date)
date
- Datepublic static int getHour(Instant instant)
instant
- Instantpublic static int getHour(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getHour(LocalTime localTime)
localTime
- localTimepublic static int getMinute(Date date)
date
- Datepublic static int getMinute(Instant instant)
instant
- Instantpublic static int getMinute(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getMinute(LocalTime localTime)
localTime
- localTimepublic static int getSecond(Date date)
date
- Datepublic static int getSecond(Instant instant)
instant
- Instantpublic static int getSecond(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getSecond(LocalTime localTime)
localTime
- localTimepublic static int getMillisecond(Date date)
date
- Datepublic static int getMillisecond(Instant instant)
instant
- Instantpublic static int getMillisecond(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getMillisecond(LocalTime localTime)
localTime
- localTimepublic static int getMillisecond(ZonedDateTime zonedDateTime)
zonedDateTime
- zonedDateTimepublic static long getEpochMilli()
public static long getEpochSecond()
public static String getEpochMilliFormat()
public static String getEpochMilliFormatFull()
public static String getEpochMilliIsoFormat()
public static String getEpochMilliIsoFormatFull()
public static String getEpochMilliIsoNotFormatNoColon()
public static String getEpochMilliIsoFormatFullNoColon()
public static Date getDate(int year, int month, int dayOfMonth)
year
- 年month
- 月dayOfMonth
- 日public static Date getDate(int year, int month, int dayOfMonth, int hour, int minute, int second)
year
- 年month
- 月dayOfMonth
- 日hour
- 时minute
- 分second
- 秒public static Date getDate(int year, int month, int dayOfMonth, int hour, int minute, int second, int milliOfSecond)
year
- 年month
- 月dayOfMonth
- 日hour
- 时minute
- 分second
- 秒milliOfSecond
- 毫秒public static Date getDateStartOfMonth(int year, int month)
year
- 年month
- 月public static Date getDateEndOfMonth(int year, int month)
year
- 年month
- 月public static int getAge(LocalDate birthDay)
birthDay
- 生日public static int getAge(Date birthDay)
birthDay
- 生日public static int getAge(LocalDateTime birthDay)
birthDay
- 生日public static int getQuarter(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getQuarter(LocalDate localDate)
localDate
- LocalDatepublic static int getQuarter(Date date)
date
- Datepublic static int getQuarterOfNow()
public static Date plusYears(Date date, long amountToAdd)
date
- DateamountToAdd
- 增加的值public static LocalDateTime plusYears(LocalDateTime localDateTime, long amountToAdd)
localDateTime
- LocalDateTimeamountToAdd
- 增加的值public static LocalDate plusYears(LocalDate localDate, long amountToAdd)
localDate
- LocalDateamountToAdd
- 增加的值public static Date plusMonths(Date date, long amountToAdd)
date
- DateamountToAdd
- 增加的值public static LocalDateTime plusMonths(LocalDateTime localDateTime, long amountToAdd)
localDateTime
- LocalDateTimeamountToAdd
- 增加的值public static LocalDate plusMonths(LocalDate localDate, long amountToAdd)
localDate
- LocalDateamountToAdd
- 增加的值public static Date plusWeeks(Date date, long amountToAdd)
date
- DateamountToAdd
- 增加的值public static LocalDateTime plusWeeks(LocalDateTime localDateTime, long amountToAdd)
localDateTime
- LocalDateTimeamountToAdd
- 增加的值public static LocalDate plusWeeks(LocalDate localDate, long amountToAdd)
localDate
- LocalDateamountToAdd
- 增加的值public static Date plusDays(Date date, long amountToAdd)
date
- DateamountToAdd
- 增加的值public static LocalDateTime plusDays(LocalDateTime localDateTime, long amountToAdd)
localDateTime
- LocalDateTimeamountToAdd
- 增加的值public static LocalDate plusDays(LocalDate localDate, long amountToAdd)
localDate
- LocalDateamountToAdd
- 增加的值public static Date plusHours(Date date, long amountToAdd)
date
- DateamountToAdd
- 增加的值public static LocalDateTime plusHours(LocalDateTime localDateTime, long amountToAdd)
localDateTime
- LocalDateTimeamountToAdd
- 增加的值public static LocalTime plusHours(LocalTime localTime, long amountToAdd)
localTime
- LocalTimeamountToAdd
- 增加的值public static Date plusMinutes(Date date, long amountToAdd)
date
- DateamountToAdd
- 增加的值public static LocalDateTime plusMinutes(LocalDateTime localDateTime, long amountToAdd)
localDateTime
- LocalDateTimeamountToAdd
- 增加的值public static LocalTime plusMinutes(LocalTime localTime, long amountToAdd)
localTime
- LocalTimeamountToAdd
- 增加的值public static Date plusSeconds(Date date, long amountToAdd)
date
- DateamountToAdd
- 增加的值public static LocalDateTime plusSeconds(LocalDateTime localDateTime, long amountToAdd)
localDateTime
- LocalDateTimeamountToAdd
- 增加的值public static LocalTime plusSeconds(LocalTime localTime, long amountToAdd)
localTime
- LocalTimeamountToAdd
- 增加的值public static Date plusMillis(Date date, long amountToAdd)
date
- DateamountToAdd
- 增加的值public static LocalDateTime plusMillis(LocalDateTime localDateTime, long amountToAdd)
localDateTime
- LocalDateTimeamountToAdd
- 增加的值public static LocalTime plusMillis(LocalTime localTime, long amountToAdd)
localTime
- LocalTimeamountToAdd
- 增加的值public static Date minusYears(Date date, long amountToSubtract)
date
- DateamountToSubtract
- 减少的值public static LocalDateTime minusYears(LocalDateTime localDateTime, long amountToSubtract)
localDateTime
- LocalDateTimeamountToSubtract
- 减少的值public static LocalDate minusYears(LocalDate localDate, long amountToSubtract)
localDate
- LocalDateamountToSubtract
- 减少的值public static Date minusMonths(Date date, long amountToSubtract)
date
- DateamountToSubtract
- 减少的值public static LocalDateTime minusMonths(LocalDateTime localDateTime, long amountToSubtract)
localDateTime
- LocalDateTimeamountToSubtract
- 减少的值public static LocalDate minusMonths(LocalDate localDate, long amountToSubtract)
localDate
- LocalDateamountToSubtract
- 减少的值public static Date minusWeeks(Date date, long amountToSubtract)
date
- DateamountToSubtract
- 减少的值public static LocalDateTime minusWeeks(LocalDateTime localDateTime, long amountToSubtract)
localDateTime
- LocalDateTimeamountToSubtract
- 减少的值public static LocalDate minusWeeks(LocalDate localDate, long amountToSubtract)
localDate
- LocalDateamountToSubtract
- 减少的值public static Date minusDays(Date date, long amountToSubtract)
date
- DateamountToSubtract
- 减少的值public static LocalDateTime minusDays(LocalDateTime localDateTime, long amountToSubtract)
localDateTime
- LocalDateTimeamountToSubtract
- 减少的值public static LocalDate minusDays(LocalDate localDate, long amountToSubtract)
localDate
- LocalDateamountToSubtract
- 减少的值public static Date minusHours(Date date, long amountToSubtract)
date
- DateamountToSubtract
- 减少的值public static LocalDateTime minusHours(LocalDateTime localDateTime, long amountToSubtract)
localDateTime
- LocalDateTimeamountToSubtract
- 减少的值public static LocalTime minusHours(LocalTime localTime, long amountToSubtract)
localTime
- LocalTimeamountToSubtract
- 减少的值public static Date minusMinutes(Date date, long amountToSubtract)
date
- DateamountToSubtract
- 减少的值public static LocalDateTime minusMinutes(LocalDateTime localDateTime, long amountToSubtract)
localDateTime
- LocalDateTimeamountToSubtract
- 减少的值public static LocalTime minusMinutes(LocalTime localTime, long amountToSubtract)
localTime
- LocalTimeamountToSubtract
- 减少的值public static Date minusSeconds(Date date, long amountToSubtract)
date
- DateamountToSubtract
- 减少的值public static LocalDateTime minusSeconds(LocalDateTime localDateTime, long amountToSubtract)
localDateTime
- LocalDateTimeamountToSubtract
- 减少的值public static LocalTime minusSeconds(LocalTime localTime, long amountToSubtract)
localTime
- LocalTimeamountToSubtract
- 减少的值public static Date minusMillis(Date date, long amountToSubtract)
date
- DateamountToSubtract
- 减少的值public static LocalDateTime minusMillis(LocalDateTime localDateTime, long amountToSubtract)
localDateTime
- LocalDateTimeamountToSubtract
- 减少的值public static LocalTime minusMillis(LocalTime localTime, long amountToSubtract)
localTime
- LocalTimeamountToSubtract
- 减少的值public static Date withYear(Date date, long newValue)
date
- DatenewValue
- 新值public static LocalDateTime withYear(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值public static LocalDate withYear(LocalDate localDate, long newValue)
localDate
- LocalDatenewValue
- 新值public static Date withMonth(Date date, long newValue)
date
- DatenewValue
- 新值public static LocalDateTime withMonth(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值public static LocalDate withMonth(LocalDate localDate, long newValue)
localDate
- LocalDatenewValue
- 新值public static Date withDayOfMonth(Date date, long newValue)
date
- DatenewValue
- 新值public static LocalDateTime withDayOfMonth(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值public static LocalDate withDayOfMonth(LocalDate localDate, long newValue)
localDate
- LocalDatenewValue
- 新值public static Date withDayOfYear(Date date, long newValue)
date
- DatenewValue
- 新值public static LocalDateTime withDayOfYear(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值public static LocalDate withDayOfYear(LocalDate localDate, long newValue)
localDate
- LocalDatenewValue
- 新值public static Date withHour(Date date, long newValue)
date
- DatenewValue
- 新值public static LocalDateTime withHour(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值public static LocalTime withHour(LocalTime localTime, long newValue)
localTime
- LocalTimenewValue
- 新值public static Date withMinute(Date date, long newValue)
date
- DatenewValue
- 新值public static LocalDateTime withMinute(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值public static LocalTime withMinute(LocalTime localTime, long newValue)
localTime
- LocalTimenewValue
- 新值public static Date withSecond(Date date, long newValue)
date
- DatenewValue
- 新值public static LocalDateTime withSecond(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值public static LocalTime withSecond(LocalTime localTime, long newValue)
localTime
- LocalTimenewValue
- 新值public static Date withMilli(Date date, long newValue)
date
- DatenewValue
- 新值public static LocalDateTime withMilli(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值public static LocalTime withMilli(LocalTime localTime, long newValue)
localTime
- LocalTimenewValue
- 新值public static Date withDayOfWeek(Date date, long newValue)
date
- DatenewValue
- 新值 1-7public static LocalDateTime withDayOfWeek(LocalDateTime localDateTime, long newValue)
localDateTime
- LocalDateTimenewValue
- 新值 1-7public static LocalDate withDayOfWeek(LocalDate localDate, long newValue)
localDate
- LocalDatenewValue
- 新值 1-7@Deprecated public static long betweenYears(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间@Deprecated public static long betweenYears(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间@Deprecated public static long betweenYears(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodYears(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodYears(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodYears(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间@Deprecated public static long betweenMonths(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间@Deprecated public static long betweenMonths(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间@Deprecated public static long betweenMonths(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodMonths(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodMonths(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodMonths(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间@Deprecated public static long betweenDays(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间@Deprecated public static long betweenDays(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间@Deprecated public static long betweenDays(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodDays(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodDays(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenPeriodDays(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalDays(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalDays(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalDays(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalHours(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalHours(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalHours(LocalTime startInclusive, LocalTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalHours(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalMinutes(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalMinutes(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalMinutes(LocalTime startInclusive, LocalTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalMinutes(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalSeconds(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalSeconds(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalSeconds(LocalTime startInclusive, LocalTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalSeconds(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalMillis(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalMillis(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalMillis(LocalTime startInclusive, LocalTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalMillis(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalNanos(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalNanos(LocalDate startInclusive, LocalDate endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalNanos(LocalTime startInclusive, LocalTime endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static long betweenTotalNanos(Date startInclusive, Date endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static int getDayOfWeek(Date date)
date
- Datepublic static int getDayOfWeek(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int getDayOfWeek(LocalDate localDate)
localDate
- LocalDatepublic static int getDayOfWeek(Instant instant)
instant
- Instantpublic static String getDayOfWeekEnLong(Date date)
date
- Datepublic static String getDayOfWeekEnLong(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getDayOfWeekEnLong(LocalDate localDate)
localDate
- LocalDatepublic static String getDayOfWeekEnLong(Instant instant)
instant
- Instantpublic static String getDayOfWeekEnShort(Date date)
date
- Datepublic static String getDayOfWeekEnShort(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getDayOfWeekEnShort(LocalDate localDate)
localDate
- LocalDatepublic static String getDayOfWeekEnShort(Instant instant)
instant
- Instantpublic static String getDayOfWeekEnShortUpper(Date date)
date
- Datepublic static String getDayOfWeekEnShortUpper(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getDayOfWeekEnShortUpper(LocalDate localDate)
localDate
- LocalDatepublic static String getDayOfWeekEnShortUpper(Instant instant)
instant
- Instantpublic static String getDayOfWeekCn(Date date)
date
- Datepublic static String getDayOfWeekCn(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getDayOfWeekCn(LocalDate localDate)
localDate
- LocalDatepublic static String getDayOfWeekCn(Instant instant)
instant
- Instantpublic static String getDayOfWeekCnShort(Date date)
date
- Datepublic static String getDayOfWeekCnShort(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getDayOfWeekCnShort(LocalDate localDate)
localDate
- LocalDatepublic static String getDayOfWeekCnShort(Instant instant)
instant
- Instantpublic static LocalDate firstDayOfMonth(LocalDate localDate)
localDate
- LocalDatepublic static LocalDateTime firstDayOfMonth(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static Date firstDayOfMonth(Date date)
date
- Datepublic static LocalDate lastDayOfMonth(LocalDate localDate)
localDate
- LocalDatepublic static LocalDateTime lastDayOfMonth(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static Date lastDayOfMonth(Date date)
date
- Datepublic static boolean isLeapYear(LocalDate localDate)
localDate
- LocalDatepublic static boolean isLeapYear(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static boolean isLeapYear(Date date)
date
- Datepublic static boolean isLeapYear(int year)
year
- 年public static int nextLeapYear(int year)
year
- 年public static LocalDateTime nextLeapYear(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static LocalDate nextLeapYear(LocalDate localDate)
localDate
- LocalDatepublic static boolean isWorkDay(Date date)
date
- Datepublic static boolean isWorkDay(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static boolean isWorkDay(LocalDate localDate)
localDate
- LocalDatepublic static boolean isWeekend(Date date)
date
- Datepublic static boolean isWeekend(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static boolean isWeekend(LocalDate localDate)
localDate
- LocalDatepublic static boolean isChineseWorkDay(Date date, String holidayData)
date
- DateholidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static boolean isChineseWorkDay(LocalDateTime localDateTime, String holidayData)
localDateTime
- LocalDateTimeholidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static boolean hasChineseWorkDay(long start, long end, String holidayData)
start
- 开始 时间戳end
- 结束 时间戳holidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static boolean hasChineseWorkDay(String start, String end, String holidayData)
start
- 开始 时间戳end
- 结束 时间戳holidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static boolean hasChineseWorkDay(Date start, Date end, String holidayData)
start
- 开始 Dateend
- 结束 DateholidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static boolean hasChineseWorkDay(LocalDate start, LocalDate end, String holidayData)
start
- 开始 LocalDateend
- 结束 LocalDateholidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static List<String> chineseWorkDay(long start, long end, String holidayData)
start
- 开始 时间戳end
- 结束 时间戳holidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static List<String> chineseWorkDay(LocalDate start, LocalDate end, String holidayData)
start
- 开始 时间戳end
- 结束 时间戳holidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static int chineseWorkDayCount(long start, long end, String holidayData)
start
- 开始 时间戳end
- 结束 时间戳holidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static boolean isChineseWorkDay(LocalDate localDate, String holidayData)
localDate
- LocalDateholidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static Date nextChineseWorkDay(Date date, String holidayData)
date
- DateholidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static LocalDateTime nextChineseWorkDay(LocalDateTime localDateTime, String holidayData)
localDateTime
- LocalDateTimeholidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static LocalDate nextChineseWorkDay(LocalDate localDate, String holidayData)
localDate
- LocalDateholidayData
- 放假信息0表示放假,1表示工作日,如:2021-01-01:0,2021-02-07:1public static int lengthOfMonth(LocalDate localDate)
localDate
- LocalDatepublic static int lengthOfMonth(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int lengthOfMonth(Date date)
date
- Datepublic static int lengthOfYear(LocalDate localDate)
localDate
- LocalDatepublic static int lengthOfYear(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int lengthOfYear(Date date)
date
- Datepublic static LocalDate next(LocalDate localDate, DayOfWeek dayOfWeek)
localDate
- 日期dayOfWeek
- 星期public static LocalDateTime next(LocalDateTime localDateTime, DayOfWeek dayOfWeek)
localDateTime
- 日期dayOfWeek
- 星期public static Date next(Date date, DayOfWeek dayOfWeek)
date
- 日期dayOfWeek
- 星期public static LocalDate previous(LocalDate localDate, DayOfWeek dayOfWeek)
localDate
- 日期dayOfWeek
- 星期public static LocalDateTime previous(LocalDateTime localDateTime, DayOfWeek dayOfWeek)
localDateTime
- 日期dayOfWeek
- 星期public static Date previous(Date date, DayOfWeek dayOfWeek)
date
- 日期dayOfWeek
- 星期public static LocalDate nextWorkDay(LocalDate localDate)
localDate
- LocalDatepublic static LocalDateTime nextWorkDay(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static ZonedDateTime getZonedDateTimeNowOfDefault()
public static ZonedDateTime getZonedDateTimeNowOfShanghai()
public static ZonedDateTime getZonedDateTimeNowOfParis()
public static ZonedDateTime getZonedDateTimeNowOfEST()
public static ZonedDateTime getZonedDateTimeNowOfTokyo()
public static Temporal plus(Temporal temporal, TemporalUnit unit, long amountToAdd)
temporal
- Temporalunit
- 单位amountToAdd
- 增加的值 增加的值public static Date plus(Date date, TemporalUnit unit, long amountToAdd)
date
- Dateunit
- 单位amountToAdd
- 增加的值 增加的值public static Temporal minus(Temporal temporal, TemporalUnit unit, long amountToSubtract)
temporal
- Temporalunit
- 单位amountToSubtract
- 减少的值public static Date minus(Date date, TemporalUnit unit, long amountToSubtract)
date
- 日期unit
- 单位amountToSubtract
- 减少的值public static Temporal with(Temporal temporal, TemporalField field, long newValue)
temporal
- Temporalfield
- 属性newValue
- 新值public static Date with(Date date, TemporalField field, long newValue)
date
- 日期field
- 属性newValue
- 新值public static Duration durationBetween(Temporal startInclusive, Temporal endExclusive)
startInclusive
- 开始时间endExclusive
- 结束时间public static Period periodBetween(LocalDate startDateInclusive, LocalDate endDateExclusive)
startDateInclusive
- 开始时间endDateExclusive
- 结束时间public static ZonedDateTime getZonedDateTimeNow(String zoneId)
zoneId
- 时区public static ZonedDateTime transform(ZonedDateTime zonedDateTime, String zoneId)
zonedDateTime
- ZonedDateTimezoneId
- 例如 Asia/Shanghaipublic static ZonedDateTime transform(ZonedDateTime zonedDateTime, ZoneId zone)
zonedDateTime
- ZonedDateTimezone
- 时区public static String transform(Date date, String zoneId)
date
- DatezoneId
- 目标时区public static String transform(Date date, ZoneId zone)
date
- Datezone
- 目标时区public static int compare(Date date1, Date date2)
date1
- 时间1date2
- 时间2public static int compare(Temporal temporal1, Temporal temporal2)
temporal1
- 时间1temporal2
- 时间2public static LocalTime startTimeOfDay()
public static LocalTime endTimeOfDay()
public static LocalTime endAccuracyTimeOfDay()
public static Date startTimeOfYesterday()
public static Date endTimeOfYesterday()
public static Date startTimeOfTomorrow()
public static Date endTimeOfTomorrow()
public static Date startTimeOfToday()
public static Date endTimeOfToday()
public static Date startTimeOfLastMonth()
public static Date endTimeOfLastMonth()
public static Date startTimeOfMonth()
public static Date endTimeOfMonth()
public static Date startTimeOfDate(Date date)
date
- Datepublic static Date endTimeOfDate(Date date)
date
- Datepublic static Date endAccuracyTimeOfDate(Date date)
date
- Datepublic static LocalDateTime startTimeOfLocalDateTime(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static LocalDateTime endAccuracyTimeOfLocalDateTime(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static Date startTimeOfSpecialMonth(int year, int month)
year
- 年month
- 月public static Date endTimeOfSpecialMonth(int year, int month)
year
- 年month
- 月public static Date startTimeOfDate(int year, int month, int dayOfMonth)
year
- 年month
- 月dayOfMonth
- 日public static Date endTimeOfDate(int year, int month, int dayOfMonth)
year
- 年month
- 月dayOfMonth
- 日public static Date startTimeOfFirstQuarter(int year)
year
- 年public static Date startTimeOfSecondQuarter(int year)
year
- 年public static Date startTimeOfThirdQuarter(int year)
year
- 年public static Date startTimeOfFourthQuarter(int year)
year
- 年public static Date endTimeOfFirstQuarter(int year)
year
- 年public static Date endTimeOfSecondQuarter(int year)
year
- 年public static Date endTimeOfThirdQuarter(int year)
year
- 年public static Date endTimeOfFourthQuarter(int year)
year
- 年public static Date startTimeOfCurrentQuarter()
public static Date endTimeOfCurrentQuarter()
public static Date startTimeOfYear(int year)
year
- 年public static Date endTimeOfYear(int year)
year
- 年public static Date startTimeOfCurrentYear()
public static Date endTimeOfCurrentYear()
public static boolean isSameMonthDay(LocalDate localDate1, MonthDay monthDay)
localDate1
- 日期1monthDay
- 月日public static boolean isSameMonthDay(LocalDate localDate1, String monthDayStr)
localDate1
- 日期1monthDayStr
- 月日字符串 MM-dd格式public static boolean isSameMonthDay(LocalDate localDate1, LocalDate localDate2)
localDate1
- 日期1localDate2
- 日期2public static boolean isSameMonthDay(Date date, String monthDayStr)
date
- 日期monthDayStr
- 月日字符串,MM-dd格式public static boolean isSameMonthDay(Date date1, Date date2)
date1
- 日期1date2
- 日期2public static boolean isSameMonthDayOfNow(String monthDayStr)
monthDayStr
- 月日字符串,MM-dd格式public static long betweenNextSameMonthDay(LocalDate localDate1, int month, int dayOfMonth)
localDate1
- 日期1month
- 月dayOfMonth
- 日public static long betweenNextSameMonthDay(LocalDate localDate, String monthDayStr)
localDate
- 日期monthDayStr
- 月日字符串,MM-dd格式public static long betweenNextSameMonthDay(Date date, String monthDayStr)
date
- 日期monthDayStr
- 月日字符串,MM-dd格式public static long betweenNextSameMonthDayOfNow(String monthDayStr)
monthDayStr
- 月日字符串,MM-dd格式public static LocalDate nextSameMonthDay(LocalDate localDate, String monthDayStr)
localDate
- 日期monthDayStr
- 月日字符串,MM-dd格式public static Date nextSameMonthDay(Date date, String monthDayStr)
date
- 日期monthDayStr
- 月日字符串,MM-dd格式public static Date nextSameMonthDayOfNow(String monthDayStr)
monthDayStr
- 月日字符串,MM-dd格式public static String getConstellationNameCn(String monthDayStr)
monthDayStr
- 月日字符串,MM-dd格式public static String getConstellationNameCn(Date date)
date
- Datepublic static String getConstellationNameEn(String monthDayStr)
monthDayStr
- 月日字符串,MM-dd格式public static List<LocalDateTime> getLocalDateTimeList(LocalDateTime start, LocalDateTime end)
start
- 开始时间end
- 结束时间public static List<LocalDateTime> getLocalDateTimeList(LocalDateTime start, LocalDateTime end, ChronoUnit unit)
start
- 开始时间end
- 结束时间unit
- 单位public static List<String> getLocalDateTimeFormatList(LocalDateTime start, LocalDateTime end, String dateFormatPattern)
start
- 开始时间end
- 结束时间dateFormatPattern
- 格式化模板 @see com.xkzhangsan.time.formatter.DateFormatPatternpublic static List<LocalDate> getLocalDateList(LocalDate start, LocalDate end)
start
- 开始时间end
- 结束时间public static List<LocalDate> getLocalDateList(LocalDate start, LocalDate end, ChronoUnit unit)
start
- 开始时间end
- 结束时间unit
- 单位public static List<Date> getDateList(Date start, Date end)
start
- 开始时间end
- 结束时间public static List<String> getDateFormatList(Date start, Date end, String dateFormatPattern)
start
- 开始时间end
- 结束时间dateFormatPattern
- 格式化模板 @see com.xkzhangsan.time.formatter.DateFormatPatternpublic static List<Date> getDateList(Date startInclusive, Date endInclusive, ChronoUnit unit)
startInclusive
- 开始时间endInclusive
- 结束时间unit
- 单位public static List<LocalDate> getLocalDateList(YearMonth yearMonth)
yearMonth
- 年月public static List<LocalDate> getLocalDateList(String yearMonthStr)
yearMonthStr
- 年月字符串,格式: yyyy-MMpublic static List<LocalDate> getLocalDateList(int year, int month)
year
- 年month
- 月public static List<LocalDateTime> getLocalDateTimeList(YearMonth yearMonth)
yearMonth
- 年月public static List<LocalDateTime> getLocalDateTimeList(String yearMonthStr)
yearMonthStr
- 年月字符串,格式: yyyy-MMpublic static List<LocalDateTime> getLocalDateTimeList(int year, int month)
year
- 年month
- 月public static List<Date> getDateList(String yearMonthStr)
yearMonthStr
- 年月字符串,格式: yyyy-MMpublic static List<Date> getDateList(int year, int month)
year
- 年month
- 月public static boolean isExpiry(YearMonth yearMonth)
yearMonth
- 年月public static boolean isExpiry(String yearMonthStr)
yearMonthStr
- 年月字符串,格式: yyyy-MMpublic static boolean isBirthDay(LocalDate birthDay)
birthDay
- 生日public static boolean isBirthDay(Date birthDay)
birthDay
- 生日public static boolean isBirthDay(LocalDateTime birthDay)
birthDay
- 生日public static LocalDateTime reduceAccuracyToSecond(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static Date reduceAccuracyToSecond(Date date)
date
- Datepublic static LocalDateTime reduceAccuracyToMinute(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static Date reduceAccuracyToMinute(Date date)
date
- Datepublic static LocalDateTime reduceAccuracyToHour(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static Date reduceAccuracyToHour(Date date)
date
- Datepublic static LocalDateTime reduceAccuracyToDay(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static Date reduceAccuracyToDay(Date date)
date
- Datepublic static int weekOfMonth(LocalDate localDate, Locale locale)
localDate
- LocalDatelocale
- 地区 为null 是取系统默认地区public static int weekOfMonth(LocalDate localDate)
localDate
- LocalDatepublic static int weekOfMonth(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int weekOfMonth(Date date)
date
- Datepublic static int weekOfMonth()
public static int weekOfYear(LocalDate localDate, Locale locale)
localDate
- LocalDatelocale
- 地区 为null 是取系统默认地区public static int weekOfYear(LocalDate localDate)
localDate
- LocalDatepublic static int weekOfYear(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static int weekOfYear(Date date)
date
- Datepublic static int weekOfYear()
public static boolean isMonday(LocalDate localDate)
localDate
- LocalDatepublic static boolean isMonday(Date date)
date
- Datepublic static boolean isZhouYi(LocalDate localDate)
localDate
- LocalDatepublic static boolean isZhouYi(Date date)
date
- Datepublic static boolean isFriday(LocalDate localDate)
localDate
- LocalDatepublic static boolean isFriday(Date date)
date
- Datepublic static boolean isZhouWu(LocalDate localDate)
localDate
- LocalDatepublic static boolean isZhouWu(Date date)
date
- Datepublic static String getTwelveTwo(LocalTime localTime)
localTime
- LocalTimepublic static String getTwelveTwo(LocalDateTime localDateTime)
localDateTime
- LocalDateTimepublic static String getTwelveTwo(Date date)
date
- Datepublic static String getTwelveTwo()
public static Date today()
public static Date tomorrow()
public static Date nextWeek()
public static Date nextMonth()
public static Date nextYear()
public static Date yesterday()
public static Date lastWeek()
public static Date lastMonth()
public static Date lastYear()
public static boolean isOverlap(long startDate1, long endDate1, long startDate2, long endDate2, boolean isStrict)
startDate1
- 时间段1开始时间戳endDate1
- 时间段1结束时间戳startDate2
- 时间段2开始时间戳endDate2
- 时间段2结束时间戳isStrict
- 是否严格重叠,true 严格,没有任何相交或相等;false 不严格,可以首尾相等,比如2021/5/29-2021/5/31和2021/5/31-2021/6/1,不重叠。public static boolean isOverlap(Date startDate1, Date endDate1, Date startDate2, Date endDate2, boolean isStrict)
startDate1
- 时间段1开始时间endDate1
- 时间段1结束时间startDate2
- 时间段2开始时间endDate2
- 时间段2结束时间isStrict
- 是否严格重叠,true 严格,没有任何相交或相等;false 不严格,可以首尾相等,比如2021-05-29到2021-05-31和2021-05-31到2021-06-01,不重叠。public static boolean isOverlap(Date startDate1, Date endDate1, Date startDate2, Date endDate2)
startDate1
- 时间段1开始时间endDate1
- 时间段1结束时间startDate2
- 时间段2开始时间endDate2
- 时间段2结束时间public static boolean isOverlap(LocalDateTime startDate1, LocalDateTime endDate1, LocalDateTime startDate2, LocalDateTime endDate2, boolean isStrict)
startDate1
- 时间段1开始时间endDate1
- 时间段1结束时间startDate2
- 时间段2开始时间endDate2
- 时间段2结束时间isStrict
- 是否严格重叠,true 严格,没有任何相交或相等;false 不严格,可以首尾相等,比如2021-05-29到2021-05-31和2021-05-31到2021-06-01,不重叠。public static boolean isOverlap(LocalDate startDate1, LocalDate endDate1, LocalDate startDate2, LocalDate endDate2, boolean isStrict)
startDate1
- 时间段1开始时间endDate1
- 时间段1结束时间startDate2
- 时间段2开始时间endDate2
- 时间段2结束时间isStrict
- 是否严格重叠,true 严格,没有任何相交或相等;false 不严格,可以首尾相等,比如2021-05-29到2021-05-31和2021-05-31到2021-06-01,不重叠。public static boolean isOverlap(TimePair[] timePairs, boolean isStrict)
timePairs
- 时间段数组isStrict
- 是否严格重叠,true 严格,没有任何相交或相等;false 不严格,可以首尾相等,比如2021-05-29到2021-05-31和2021-05-31到2021-06-01,不重叠。public static boolean isOverlap(List<TimePair> timePairList, boolean isStrict)
timePairList
- 时间段列表isStrict
- 是否严格重叠,true 严格,没有任何相交或相等;false 不严格,可以首尾相等,比如2021-05-29到2021-05-31和2021-05-31到2021-06-01,不重叠。public static long overlapTime(long startDate1, long endDate1, long startDate2, long endDate2)
startDate1
- 时间段1开始时间戳endDate1
- 时间段1结束时间戳startDate2
- 时间段2开始时间戳endDate2
- 时间段2结束时间戳public static long overlapTime(Date startDate1, Date endDate1, Date startDate2, Date endDate2)
startDate1
- 时间段1开始时间戳endDate1
- 时间段1结束时间戳startDate2
- 时间段2开始时间戳endDate2
- 时间段2结束时间戳public static LocalTime averageTime(List<Date> dateList)
dateList
- 待计算列表public static String countdown(long millis)
millis
- 相差毫秒值public static String countdown(Date start, String unitNames)
start
- 开始时间unitNames
- 单位,英文逗号分隔,比如"小时,分钟,秒", "时,分,秒","时,分"public static String countdown(Date start, Date end, String unitNames)
start
- 开始时间end
- 结束时间unitNames
- 单位,英文逗号分隔,比如"小时,分钟,秒", "时,分,秒","时,分"public static String countdown(long millis, String unitNames)
millis
- 相差毫秒值unitNames
- 单位,英文逗号分隔,比如"小时,分钟,秒", "时,分,秒","时,分"public static String countdownWithDay(long millis)
millis
- 相差毫秒值public static String countdownWithDay(long millis, String unitNames)
millis
- 相差毫秒值unitNames
- 单位,英文逗号分隔,比如"天,小时,分钟,秒", "天,时,分,秒","天,时,分"public static String countdownWithDay(Date start, String unitNames)
start
- 时间参数unitNames
- 单位,英文逗号分隔,比如"天,小时,分钟,秒", "天,时,分,秒","天,时,分"Copyright © 2021. All rights reserved.