| Constructor and Description |
|---|
Almanac() |
| Modifier and Type | Method and Description |
|---|---|
static Calendar |
beginOfDay(Calendar calendar)
获取某天的开始时间
|
static DateTime |
beginOfDay(Date date)
获取某天的开始时间
|
static Calendar |
beginOfHour(Calendar calendar)
获取某小时的开始时间
|
static DateTime |
beginOfHour(Date date)
获取某小时的开始时间
|
static Calendar |
beginOfMinute(Calendar calendar)
获取某分钟的开始时间
|
static DateTime |
beginOfMinute(Date date)
获取某分钟的开始时间
|
static Calendar |
beginOfMonth(Calendar calendar)
获取某月的开始时间
|
static DateTime |
beginOfMonth(Date date)
获取某月的开始时间
|
static Calendar |
beginOfQuarter(Calendar calendar)
获取某季度的开始时间
|
static DateTime |
beginOfQuarter(Date date)
获取某季度的开始时间
|
static Calendar |
beginOfSecond(Calendar calendar)
获取秒级别的开始时间,即忽略毫秒部分
|
static DateTime |
beginOfSecond(Date date)
获取秒级别的开始时间,即忽略毫秒部分
|
static Calendar |
beginOfWeek(Calendar calendar)
获取给定日期当前周的开始时间,周一定为一周的开始时间
|
static Calendar |
beginOfWeek(Calendar calendar,
boolean isMondayAsFirstDay)
获取给定日期当前周的开始时间
|
static DateTime |
beginOfWeek(Date date)
获取某周的开始时间,周一定为一周的开始时间
|
static Calendar |
beginOfYear(Calendar calendar)
获取某年的开始时间
|
static DateTime |
beginOfYear(Date date)
获取某年的开始时间
|
static long |
between(Date beginDate,
Date endDate,
Fields.Units units)
判断两个日期相差的时长,只保留绝对值
|
static long |
between(Date beginDate,
Date endDate,
Fields.Units units,
boolean isAbs)
判断两个日期相差的时长
|
static long |
betweenDay(Date beginDate,
Date endDate,
boolean isReset)
判断两个日期相差的天数
|
static long |
betweenDays(Date startInclusive,
Date endExclusive)
获取2个日期的相差年月天的天数
比如2020-02-29 2021-03-06,返回6
|
static long |
betweenDays(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差年月天的天数
比如2020-02-29 2021-03-06,返回6
|
static long |
betweenDays(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差年月天的天数
比如2020-02-29 2021-03-07,返回7
|
static long |
betweenMonth(Date beginDate,
Date endDate,
boolean isReset)
计算两个日期相差月数
在非重置情况下,如果起始日期的天大于结束日期的天,月数要少算1(不足1个月)
|
static long |
betweenMonths(Date startInclusive,
Date endExclusive)
获取2个日期的相差年月天的月数
比如2020-02-29 2021-03-07,返回0
|
static long |
betweenMonths(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差年月天的月数
比如2020-02-29 2021-03-07,返回0
|
static long |
betweenMonths(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差年月天的月数
比如2020-02-29 2021-03-07,返回0
|
static long |
betweenMs(Date beginDate,
Date endDate)
判断两个日期相差的毫秒数
|
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 |
betweenTotalDays(Date startInclusive,
Date endExclusive)
获取2个日期的相差总天数
|
static long |
betweenTotalDays(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总天数
|
static long |
betweenTotalHours(Date startInclusive,
Date 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(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总毫秒数
|
static long |
betweenTotalMillis(LocalTime startInclusive,
LocalTime endExclusive)
获取2个日期的相差总毫秒数
|
static long |
betweenTotalMinutes(Date startInclusive,
Date 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(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总纳秒数
|
static long |
betweenTotalNanos(LocalTime startInclusive,
LocalTime endExclusive)
获取2个日期的相差总纳秒数
|
static long |
betweenTotalSeconds(Date startInclusive,
Date endExclusive)
获取2个日期的相差总秒数
|
static long |
betweenTotalSeconds(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差总秒数
|
static long |
betweenTotalSeconds(LocalTime startInclusive,
LocalTime endExclusive)
获取2个日期的相差总秒数
|
static long |
betweenYear(Date beginDate,
Date endDate,
boolean isReset)
计算两个日期相差年数
在非重置情况下,如果起始日期的月大于结束日期的月,年数要少算1(不足1年)
|
static long |
betweenYears(Date startInclusive,
Date endExclusive)
获取2个日期的相差年月天的年数
比如2020-02-29 2021-03-07,返回1
|
static long |
betweenYears(LocalDate startInclusive,
LocalDate endExclusive)
获取2个日期的相差年月天的年数
比如2020-02-29 2021-03-07,返回1
|
static long |
betweenYears(LocalDateTime startInclusive,
LocalDateTime endExclusive)
获取2个日期的相差年月天的年数
比如2020-02-29 2021-03-07,返回1
|
static Calendar |
ceiling(Calendar calendar,
Fields.Type type)
修改日期为某个时间字段结束时间
|
static Calendar |
ceiling(Calendar calendar,
int dateField,
Fields.Modify modify)
修改日期
|
static Calendar |
ceiling(Calendar calendar,
int field,
Fields.Modify modify,
boolean truncateMillisecond)
修改日期,取起始值或者结束值可选是否归零毫秒。
在
Fields.Modify#TRUNCATE模式下,毫秒始终要归零,
但是在Fields.Modify#CEILING和Fields.Modify#ROUND模式下
有时候由于毫秒部分必须为0(如MySQL数据库中),因此在此加上选项 |
static DateTime |
ceiling(Date date,
Fields.Type type)
修改日期为某个时间字段结束时间
|
static int |
compare(Date date)
两个时间比较
|
static int |
compare(Date date1,
Date date2)
比较2个时间Date
|
static int |
compare(long date)
两个时间比较(时间戳比较)
|
static boolean |
compare(String object)
两个时间比较(时间戳比较)
|
static int |
compare(Temporal temporal1,
Temporal temporal2)
比较2个时间,可用于LocalDateTime,LocalDate,LocalTime,Instant
|
static DateTime |
date()
转换为
DateTime对象 |
static DateTime |
date(Calendar calendar)
|
static DateTime |
date(Date date)
|
static DateTime |
date(long date)
Long类型时间转为
DateTime
同时支持10位秒级别时间戳和13位毫秒级别时间戳 |
static DateTime |
date(TemporalAccessor temporalAccessor)
|
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 Calendar |
endOfDay(Calendar calendar)
获取某天的结束时间
|
static DateTime |
endOfDay(Date date)
获取某天的结束时间
|
static Calendar |
endOfHour(Calendar calendar)
获取某小时的结束时间
|
static DateTime |
endOfHour(Date date)
获取某小时的结束时间
|
static Calendar |
endOfMinute(Calendar calendar)
获取某分钟的结束时间
|
static DateTime |
endOfMinute(Date date)
获取某分钟的结束时间
|
static Calendar |
endOfMonth(Calendar calendar)
获取某月的结束时间
|
static DateTime |
endOfMonth(Date date)
获取某月的结束时间
|
static Calendar |
endOfQuarter(Calendar calendar)
获取某季度的结束时间
|
static DateTime |
endOfQuarter(Date date)
获取某季度的结束时间
|
static Calendar |
endOfSecond(Calendar calendar)
获取秒级别的结束时间,即毫秒设置为999
|
static DateTime |
endOfSecond(Date date)
获取秒级别的结束时间,即毫秒设置为999
|
static Calendar |
endOfWeek(Calendar calendar)
获取某周的结束时间,周日定为一周的结束
|
static Calendar |
endOfWeek(Calendar calendar,
boolean isSundayAsLastDay)
获取某周的结束时间
|
static DateTime |
endOfWeek(Date date)
获取某周的结束时间
|
static Calendar |
endOfYear(Calendar calendar)
获取某年的结束时间
|
static DateTime |
endOfYear(Date date)
获取某年的结束时间
|
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 String |
formatBetween(Date beginDate,
Date endDate)
格式化日期间隔输出,精确到毫秒
|
static String |
formatBetween(Date beginDate,
Date endDate,
Fields.Units units)
格式化日期间隔输出
|
static String |
formatBetween(long betweenMs)
格式化日期间隔输出,精确到毫秒
|
static String |
formatBetween(long betweenMs,
Fields.Units units)
格式化日期间隔输出
|
static int |
getAge(Calendar birthday,
Calendar dateToCompare)
计算相对于dateToCompare的年龄,长用于计算指定生日在某年的年龄
|
static int |
getAge(Date birthDay)
计算年龄
|
static int |
getAge(Date birthday,
Date dateToCompare)
计算相对于dateToCompare的年龄,长用于计算指定生日在某年的年龄
|
static int |
getAge(LocalDate birthDay)
计算年龄
|
static int |
getAge(LocalDateTime birthDay)
计算年龄
|
static int |
getAge(long birthDay,
long dateToCompare)
计算相对于dateToCompare的年龄,长用于计算指定生日在某年的年龄
|
static int |
getAge(String birthday)
出生日期转年龄
|
static String |
getAge(String birthDay,
String dateToCompare)
计算年龄, 返回几周岁几个月几天
|
static String |
getAnimal(Calendar calendar)
通过生日计算生肖,只计算1900年后出生的人
|
static String |
getAnimal(Date date)
通过生日计算生肖,只计算1900年后出生的人
|
static String |
getAnimal(int year)
获取生肖名称
|
static int |
getBeginValue(Calendar calendar,
int dateField)
获取指定日期字段的最小值,例如分钟的最小值是0
|
static String |
getChrono()
获取当前时间对应的十二时辰
|
static String |
getChrono(Date date)
获取指定时间对应的十二时辰
|
static String |
getChrono(LocalDateTime localDateTime)
获取指定时间对应的十二时辰
|
static String |
getChrono(LocalTime localTime)
获取指定时间对应的十二时辰
|
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<Date> |
getDateList(Date startInclusive,
Date endInclusive)
获取指定区间的时间列表,包含起始
|
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 String |
getDayOfMonth(int lunarDay)
获取农历日的表示
|
static int |
getDayOfMonth(int month,
boolean isLeapYear)
获得指定月份的总天数
|
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 int |
getEndValue(Calendar calendar,
int dateField)
获取指定日期字段的最大值,例如分钟的最大值是59
|
static long |
getEpochMilli()
获取时间戳
|
static String |
getEpochMilliFormat()
获取格式化时间戳字符串
|
static String |
getEpochMilliFormatFull()
获取格式化时间戳字符串,带毫秒
|
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 |
getInterval(Date start,
Date end)
获取两个日期段相差的周数
|
static Map<String,String> |
getLast(int type,
String beginkey,
String endkey,
String begin,
String end)
计算去年同期和上期的起止时间
|
static Map<String,String> |
getLast(int type,
String beginkey,
String endkey,
String beginWkey,
String endWkey,
String begin,
String end,
String beginW,
String endW)
(周)计算(周) 上期和去年同期的起止日期和起止周 计算上期的起止时间 和去年同期 type 0本期 1上期 2去年同期 起始日期key
beginkey endkey 起始日期的起止周key beginWkey endWkey 本期:begin end 本期起止周
beginW、endW
|
static List<String> |
getLast(String begin,
String end)
计算时间段内的所有的天
type:0本期1上期2去年同期
|
static Map<String,String> |
getLast(String beginkey,
String endkey,
String begin,
String end)
(年)计算本期(年)的上期
|
static int |
getLengthOfYear(int year)
获取某年的总天数
|
static List<LocalDate> |
getLocalDateList(int year,
int month)
获取指定年月的所有日期列表
|
static List<LocalDate> |
getLocalDateList(LocalDate startInclusive,
LocalDate endInclusive)
获取指定区间的时间列表,包含起始
|
static List<LocalDate> |
getLocalDateList(String yearMonthStr)
获取指定年月的所有日期列表
|
static List<LocalDate> |
getLocalDateList(YearMonth yearMonth)
获取指定年月的所有日期列表
|
static List<LocalDateTime> |
getLocalDateTimeList(int year,
int month)
获取指定年月的所有日期列表
|
static List<LocalDateTime> |
getLocalDateTimeList(LocalDateTime startInclusive,
LocalDateTime endInclusive)
获取指定区间的时间列表,包含起始
|
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 String |
getMonth(int month)
获取农历月份
|
static Map<String,String> |
getMonth(int type,
String beginkey,
String endkey,
String begin,
String end)
(月)计算本期的上期和去年同期 1 上期 2同期 返回的mapkay beginkey endkey 本期起止:begin end
计算上期的起止时间 和去年同期 type 0本期 1上期 2去年同期
|
static int |
getMonth(LocalDate localDate)
获取月, 比如 1
LocalDateTime LocalDate ZonedDateTime 可以直接getMonthValue()
|
static int |
getMonth(LocalDateTime localDateTime)
获取月, 比如 1
LocalDateTime LocalDate ZonedDateTime 可以直接getMonthValue()
|
static List<String> |
getMonth(String startDate,
String endDate)
当时间段内的所有月份
|
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 |
getMonthOfQuarter(int quarter)
根据季度返回季度第一月
|
static String |
getMonthOfQuarter(int type,
int quarter)
根据季度返回季度第一月或最后一月 0 起始月 1截止月
|
static int |
getQuarter()
获得当前季度值
|
static int |
getQuarter(Date date)
获得季度值
|
static LinkedHashSet<String> |
getQuarter(Date startDate,
Date endDate)
获得指定日期区间内的年份和季节
|
static Map<String,String> |
getQuarter(int type,
String beginkey,
String endkey,
String beginWkey,
String endWkey,
String begin,
String end,
String beginW,
String endW)
(季度) 计算本期的上期起止时间和同期的起止时间 返回的mao key 时间起止:beginkey endkey 季度起止: beginWkey
endWkey 本期的时间起止:begin end 季度:beginW endW type 0本期 1上期 2去年同期 季度
|
static int |
getQuarter(LocalDate localDate)
获得季度值
|
static int |
getQuarter(LocalDateTime localDateTime)
获得季度值
|
static LinkedHashSet<String> |
getQuarter(long startDate,
long endDate)
获得指定日期区间内的年份和季节
|
static List<String> |
getQuarter(String StartDate,
String beginQ,
String endDate,
String endQ)
(季度)获取季度份时间段内的所有季度
|
static int |
getQuarterOfMonth(int month)
根据月份获取所在季度
|
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 int |
getWeek(Date start,
Date end)
获取两个日期段相差的周数
|
static int |
getWeek(String year)
返回该年有多少个自然周
|
static List<String> |
getWeek(String begin,
String end,
String startw,
String endW)
(周)返回起止时间内的所有自然周
|
static int |
getWeeks(Date start,
Date end)
计算指定指定时间区间内的周数
|
static int |
getYear(Date date)
获取年,比如2020
|
static int |
getYear(Instant instant)
获取年,比如2020
|
static String |
getYear(int year)
获取农历年份
|
static int |
getYear(LocalDate localDate)
获取年,比如2020
LocalDateTime LocalDate ZonedDateTime 可以直接getYear()
|
static int |
getYear(LocalDateTime localDateTime)
获取年,比如2020
LocalDateTime LocalDate ZonedDateTime 可以直接getYear()
|
static List<String> |
getYear(String startDate,
String endDate)
获取年份时间段内的所有年
|
static String |
getZodiac(Calendar calendar)
通过生日计算星座
|
static String |
getZodiac(Date date)
通过生日计算星座
|
static String |
getZodiac(int month,
int day)
通过生日计算星座
|
static String |
getZodiacCnName(Date date)
根据日期查询星座中文名称
|
static String |
getZodiacCnName(String monthDay)
根据日期查询星座中文名称
|
static String |
getZodiacEnName(Date date)
根据日期查询星座中文名称
|
static String |
getZodiacEnName(String monthDay)
根据日期查询星座英文名称
|
static ZonedDateTime |
getZonedDateTimeNow(String zoneId)
获取时区当前时间
|
static ZonedDateTime |
getZonedDateTimeNowOfCTT()
获取当前上海时区时间(北京时间)
|
static ZonedDateTime |
getZonedDateTimeNowOfDefault()
获取当前系统当前时区时间
|
static ZonedDateTime |
getZonedDateTimeNowOfECT()
获取当前巴黎时区时间
|
static ZonedDateTime |
getZonedDateTimeNowOfEST()
获取当前美国东部标准时区
|
static ZonedDateTime |
getZonedDateTimeNowOfJST()
获取当前东京时区时间
|
static boolean |
isAM(Calendar calendar)
是否为上午
|
static boolean |
isAM(Date date)
是否为上午
|
static boolean |
isBefore(String go,
String back)
校验前面的日期go,是否早于或者等于后面的日期back
|
static boolean |
isBefore(String go,
String back,
String pattern)
校验前面的日期go,是否早于或者等于后面的日期back
|
static boolean |
isBirthDay(Date birthDay)
是否为生日
|
static boolean |
isBirthDay(LocalDate birthDay)
是否为生日
|
static boolean |
isBirthDay(LocalDateTime birthDay)
是否为生日
|
static boolean |
isDate(String dptDate)
校验日期格式,日期不能早于当前天, 默认日期转义格式:yyyy-MM-dd
|
static boolean |
isDate(String dptDate,
String pattern)
校验日期格式,日期不能早于当前天
|
static boolean |
isDatetime(String datetime)
验证长日期格式yyyy-MM-dd HH:mm:ss
|
static boolean |
isExpiry(String yearMonthStr)
判断是否过期,(输入年月小于当前年月)
|
static boolean |
isExpiry(YearMonth yearMonth)
判断是否过期,(输入年月小于当前年月)
|
static boolean |
isFriday(Date date)
是否为周五
|
static boolean |
isFriday(LocalDate localDate)
是否为周五
|
static boolean |
isIn(Date date,
Date beginDate,
Date endDate)
判定在指定检查时间是否过期
当前日期是否在日期指定范围内
起始日期和结束日期可以互换
|
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 |
isNotLessThanToday(String date)
判断传入的日期是否 >=今天
|
static boolean |
isNotLessThanToday(String date,
String format)
判断传入的日期是否>=今天
|
static boolean |
isPM(Calendar calendar)
是否为下午
|
static boolean |
isPM(Date date)
是否为下午
|
static boolean |
isSameDay(Calendar cal1,
Calendar cal2)
比较两个日期是否为同一天
|
static boolean |
isSameMonth(Calendar cal1,
Calendar cal2)
比较两个日期是否为同一月
|
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 |
isSameTime(Calendar date1,
Calendar date2)
检查两个Calendar时间戳是否相同
此方法检查两个Calendar的毫秒数时间戳是否相同
|
static boolean |
isSameTime(Date date1,
Date date2)
是否为相同时间
此方法比较两个日期的时间戳是否相同
|
static boolean |
isShortDate(String date)
校验短日期格式[yyyyMMdd]
|
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 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 |
next(Date date,
DayOfWeek dayOfWeek)
下一个星期几
|
static LocalDate |
next(LocalDate localDate,
DayOfWeek dayOfWeek)
下一个星期几
|
static LocalDateTime |
next(LocalDateTime localDateTime,
DayOfWeek dayOfWeek)
下一个星期几
|
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 TemporalAdjuster |
nextWorkDay()
下一个工作日
|
static Date |
nextWorkDay(Date date)
获下一个工作日
|
static LocalDate |
nextWorkDay(LocalDate localDate)
获下一个工作日
|
static LocalDateTime |
nextWorkDay(LocalDateTime localDateTime)
获下一个工作日
|
static Date |
nextYear()
明年日期
|
static DateTime |
offset(Date date,
Fields.Type type,
int offset)
获取指定日期偏移指定时间后的时间
|
static DateTime |
offsetDay(Date date,
int offset)
偏移天
|
static DateTime |
offsetHour(Date date,
int offset)
偏移小时
|
static DateTime |
offsetMillisecond(Date date,
int offset)
偏移毫秒数
|
static DateTime |
offsetMinute(Date date,
int offset)
偏移分钟
|
static DateTime |
offsetMonth(Date date,
int offset)
偏移月
|
static DateTime |
offsetSecond(Date date,
int offset)
偏移秒数
|
static DateTime |
offsetWeek(Date date,
int offset)
偏移周
|
static DateTime |
offsetYear(Date date,
int offset)
偏移月
|
static Period |
periodBetween(LocalDate startDateInclusive,
LocalDate endDateExclusive)
获取2个日期的相差年月日部分属性
|
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 Calendar |
round(Calendar calendar,
Fields.Type type)
修改日期为某个时间字段四舍五入时间
|
static DateTime |
round(Date date,
Fields.Type type)
修改日期为某个时间字段四舍五入时间
|
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 int |
thisMonth()
当前月份
|
static int |
thisWeek()
当前日期是星期几
|
static int |
thisYear()
当前年份
|
static long |
timestamp()
当前时间毫秒数
|
static long |
timestamp(boolean isNano)
当前时间long
|
static String |
today()
当前时间,格式 yyyy-MM-dd HH:mm:ss
|
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 Calendar |
truncate(Calendar calendar,
Fields.Type type)
修改日期为某个时间字段起始时间
|
static DateTime |
truncate(Date date,
Fields.Type type)
修改日期为某个时间字段起始时间
|
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()
昨天日期
|
toCalendar, toCalendar, toCalendar, toDate, toDate, toDate, toDate, toDate, toDate, toDate, toDateEndOfMonth, toDateStartOfMonth, toEpochMilli, toEpochMilli, toEpochMilli, toEpochMilli, toEpochMilli, toEpochMilli, toInstant, toInstant, toInstant, toInstant, toInstant, toInstant, toInstant, toInstant, toInstant, toLocalDate, toLocalDate, toLocalDate, toLocalDate, toLocalDate, toLocalDate, toLocalDate, toLocalDateEndOfMonth, toLocalDateStartOfMonth, toLocalDateTime, toLocalDateTime, toLocalDateTime, toLocalDateTime, toLocalDateTime, toLocalDateTime, toLocalDateTime, toLocalDateTime, toLocalTime, toLocalTime, toLocalTime, toLocalTime, toLocalTime, toSecond, toTime, toTimestamp, toTimestamp, toTimestamp, toTimestamp, toYearMonth, toYearMonth, toYearMonth, toYearMonth, toYearMonth, toZonedDateTime, toZonedDateTime, toZonedDateTime, toZonedDateTime, toZonedDateTime, toZonedDateTime, toZonedDateTime, toZonedDateTime, toZonedDateTime, toZonedDateTimeformat, format, format, format, format, format, format, format, format, format, format, format, format, format, format, format, formatDate, formatDate, formatTime, newSimpleFormat, newSimpleFormat, parse, parse, parse, parse, parse, parse, parse, parse, parse, parse, parseByPatterns, parseByPatterns, parseByPatterns, parseCST, parseDate, parseDateTime, parseTime, parseTimeToday, parseUTC, toIntSecondpublic static String getYear(int year)
year - 农历年数值表示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 List<String> getYear(String startDate, String endDate)
startDate - 开始时间endDate - 截止时间public static LinkedHashSet<String> getQuarter(Date startDate, Date endDate)
startDate - 起始日期(包含)endDate - 结束日期(包含)public static LinkedHashSet<String> getQuarter(long startDate, long endDate)
startDate - 起始日期(包含)endDate - 结束日期(包含)public static Map<String,String> getQuarter(int type, String beginkey, String endkey, String beginWkey, String endWkey, String begin, String end, String beginW, String endW)
type - 计算上期beginkey - 开始时间keyendkey - 截止时间keybeginWkey - 开始周keyendWkey - 截止周keybegin - 开始时间end - 截止时间beginW - 开始周endW - 截止周public static List<String> getQuarter(String StartDate, String beginQ, String endDate, String endQ)
StartDate - 开始日期beginQ - 开始季度endDate - 截止日期endQ - 结束季度public static String getMonth(int month)
month - 农历月数值表示public 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 List<String> getMonth(String startDate, String endDate)
startDate - 开始日期endDate - 结束日期public static Map<String,String> getMonth(int type, String beginkey, String endkey, String begin, String end)
type - 计算上期beginkey - 开始时间keyendkey - 截止时间keybegin - 开始时间end - 截止时间public 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 getMonthOfQuarter(int quarter)
quarter - 季度public static String getMonthOfQuarter(int type, int quarter)
type - 第一个月份quarter - 季度public static int getQuarterOfMonth(int month)
month - 月份public static List<String> getWeek(String begin, String end, String startw, String endW)
begin - 时间起end - 时间止startw - 周起endW - 周止public static int getWeek(String year)
year - 最多53 一般52 如果12月月末今天在本年53周(属于第二年第一周) 那么按照当年52周算public static int getWeek(Date start, Date end)
start - 日期end - 日期public static String getDayOfMonth(int lunarDay)
lunarDay - 农历日数值表示public static int getDayOfMonth(int month,
boolean isLeapYear)
month - 月份isLeapYear - 是否闰年public 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 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 getAge(String birthday)
birthday - 时间戳字符串public static int getAge(Date birthday, Date dateToCompare)
birthday - 生日dateToCompare - 需要对比的日期public static int getAge(Calendar birthday, Calendar dateToCompare)
birthday - 生日dateToCompare - 需要对比的日期public static int getAge(long birthDay,
long dateToCompare)
birthDay - 生日dateToCompare - 需要对比的日期public static String getAge(String birthDay, String dateToCompare)
birthDay - 出生日期:yyyy-MM-dddateToCompare - 对比日期: yyyy-MM-dd, 默认当前系统日期public static int getQuarter(LocalDateTime localDateTime)
localDateTime - LocalDateTimepublic static int getQuarter(LocalDate localDate)
localDate - LocalDatepublic static int getQuarter(Date date)
date - Datepublic static int getQuarter()
public static Map<String,String> getLast(int type, String beginkey, String endkey, String begin, String end)
type - 计算上期beginkey - 开始时间keyendkey - 截止时间keybegin - 开始时间end - 截止时间public static List<String> getLast(String begin, String end)
begin - 起始日期end - 截止日期public static Map<String,String> getLast(int type, String beginkey, String endkey, String beginWkey, String endWkey, String begin, String end, String beginW, String endW)
type - 计算上期beginkey - 开始时间keyendkey - 截止时间keybeginWkey - 开始周keyendWkey - 截止周keybegin - 开始时间end - 截止时间beginW - 开始周endW - 截止周public static Map<String,String> getLast(String beginkey, String endkey, String begin, String end)
beginkey - 开始时间keyendkey - 截止时间keybegin - 开始时间end - 截止时间public static int getInterval(Date start, Date end)
start - 日期end - 日期public static int getWeeks(Date start, Date end)
start - 开始时间end - 结束时间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-7public static long betweenYears(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenYears(Date startInclusive, Date endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenYears(LocalDate startInclusive, LocalDate endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenMonths(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenMonths(Date startInclusive, Date endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenMonths(LocalDate startInclusive, LocalDate endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenDays(LocalDateTime startInclusive, LocalDateTime endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenDays(Date startInclusive, Date endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenDays(LocalDate startInclusive, LocalDate endExclusive)
startInclusive - 开始时间endExclusive - 结束时间public static long betweenTotalDays(LocalDateTime startInclusive, LocalDateTime 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(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(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(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(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(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 DateTime beginOfSecond(Date date)
date - 日期DateTimepublic static DateTime endOfSecond(Date date)
date - 日期DateTimepublic static DateTime beginOfMinute(Date date)
date - 日期DateTimepublic static DateTime endOfMinute(Date date)
date - 日期DateTimepublic static DateTime beginOfDay(Date date)
date - 日期DateTimepublic static DateTime endOfDay(Date date)
date - 日期DateTimepublic static DateTime beginOfHour(Date date)
date - 日期DateTimepublic static DateTime endOfHour(Date date)
date - 日期DateTimepublic static DateTime beginOfWeek(Date date)
date - 日期DateTimepublic static DateTime endOfWeek(Date date)
date - 日期DateTimepublic static Calendar beginOfWeek(Calendar calendar, boolean isMondayAsFirstDay)
public static DateTime beginOfMonth(Date date)
date - 日期DateTimepublic static DateTime endOfMonth(Date date)
date - 日期DateTimepublic static DateTime beginOfQuarter(Date date)
date - 日期DateTimepublic static DateTime endOfQuarter(Date date)
date - 日期DateTimepublic static DateTime beginOfYear(Date date)
date - 日期DateTimepublic static DateTime endOfYear(Date date)
date - 日期DateTimepublic 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 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 TemporalAdjuster nextWorkDay()
public static ZonedDateTime getZonedDateTimeNowOfDefault()
public static ZonedDateTime getZonedDateTimeNowOfCTT()
public static ZonedDateTime getZonedDateTimeNowOfECT()
public static ZonedDateTime getZonedDateTimeNowOfEST()
public static ZonedDateTime getZonedDateTimeNowOfJST()
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 int compare(Date date)
date - 日期public static int compare(long date)
date - 日期public static boolean compare(String object)
object - 字符串日期public 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 isSameTime(Calendar date1, Calendar date2)
date1 - 时间1date2 - 时间2null返回true,否则有null返回falsepublic static boolean isSameTime(Date date1, Date date2)
date1 - 日期1date2 - 日期2public static boolean isSameDay(Calendar cal1, Calendar cal2)
cal1 - 日期1cal2 - 日期2public static boolean isSameMonth(Calendar cal1, Calendar cal2)
cal1 - 日期1cal2 - 日期2public 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 getZodiacCnName(String monthDay)
monthDay - 月日字符串,MM-dd格式public static String getZodiacCnName(Date date)
date - Datepublic static String getZodiacEnName(String monthDay)
monthDay - 月日字符串,MM-dd格式public static String getZodiacEnName(Date date)
date - Datepublic static String getZodiac(Calendar calendar)
calendar - 出生日期public static String getZodiac(int month, int day)
month - 月,从0开始计数day - 天public static List<LocalDateTime> getLocalDateTimeList(LocalDateTime startInclusive, LocalDateTime endInclusive)
startInclusive - 开始时间endInclusive - 结束时间public static List<LocalDate> getLocalDateList(LocalDate startInclusive, LocalDate endInclusive)
startInclusive - 开始时间endInclusive - 结束时间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 List<Date> getDateList(Date startInclusive, Date endInclusive)
startInclusive - 开始时间endInclusive - 结束时间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 isFriday(LocalDate localDate)
localDate - LocalDatepublic static boolean isFriday(Date date)
date - Datepublic static boolean isDate(String dptDate, String pattern)
dptDate - 日期, 仅需包含年月日pattern - 日期转移格式public static boolean isDate(String dptDate)
dptDate - 日期,仅需包含年月日public static boolean isBefore(String go, String back, String pattern)
go - 日期1back - 日期2pattern - 日期正则表达式public static boolean isBefore(String go, String back)
go - 日期1back - 日期2public static boolean isDatetime(String datetime)
datetime - 日期public static boolean isShortDate(String date)
date - 短日期public static boolean isNotLessThanToday(String date)
date - 待判断的日期public static boolean isNotLessThanToday(String date, String format)
date - 待判断的日期format - 格式public static boolean isAM(Date date)
date - 日期public static boolean isAM(Calendar calendar)
calendar - Calendarpublic static boolean isPM(Date date)
date - 日期public static boolean isPM(Calendar calendar)
calendar - Calendarpublic static boolean isIn(Date date, Date beginDate, Date endDate)
date - 被检查的日期beginDate - 起始日期endDate - 结束日期public static String getChrono(LocalTime localTime)
localTime - LocalTimepublic static String getChrono(LocalDateTime localDateTime)
localDateTime - LocalDateTimepublic static String getChrono(Date date)
date - Datepublic static String getChrono()
public static String getAnimal(Date date)
date - 出生日期(年需农历)public static String getAnimal(Calendar calendar)
calendar - 出生日期(年需农历)public static String getAnimal(int year)
year - 农历年public static int getBeginValue(Calendar calendar, int dateField)
calendar - CalendardateField - Fields.TypeCalendar.getActualMinimum(int)public static int getEndValue(Calendar calendar, int dateField)
calendar - CalendardateField - Fields.TypeCalendar.getActualMaximum(int)public static DateTime date(long date)
DateTime
同时支持10位秒级别时间戳和13位毫秒级别时间戳date - Long类型Date(Unix时间戳)public static DateTime date(TemporalAccessor temporalAccessor)
temporalAccessor - TemporalAccessorpublic static DateTime ceiling(Date date, Fields.Type type)
public static Calendar ceiling(Calendar calendar, Fields.Type type)
public static Calendar ceiling(Calendar calendar, int dateField, Fields.Modify modify)
public static Calendar ceiling(Calendar calendar, int field, Fields.Modify modify, boolean truncateMillisecond)
Fields.Modify#TRUNCATE模式下,毫秒始终要归零,
但是在Fields.Modify#CEILING和Fields.Modify#ROUND模式下
有时候由于毫秒部分必须为0(如MySQL数据库中),因此在此加上选项public static DateTime truncate(Date date, Fields.Type type)
public static Calendar truncate(Calendar calendar, Fields.Type type)
public static DateTime round(Date date, Fields.Type type)
public static Calendar round(Calendar calendar, Fields.Type type)
public static long between(Date beginDate, Date endDate, Fields.Units units)
beginDate - 起始日期endDate - 结束日期units - 相差的单位public static long between(Date beginDate, Date endDate, Fields.Units units, boolean isAbs)
beginDate - 起始日期endDate - 结束日期units - 相差的单位isAbs - 日期间隔是否只保留绝对值正数public static long betweenMs(Date beginDate, Date endDate)
beginDate - 起始日期endDate - 结束日期public static long betweenDay(Date beginDate, Date endDate, boolean isReset)
有时候我们计算相差天数的时候需要忽略时分秒 比如:2016-02-01 23:59:59和2016-02-02 00:00:00相差一秒 如果isReset为false相差天数为0 如果isReset为true相差天数将被计算为1
beginDate - 起始日期endDate - 结束日期isReset - 是否重置时间为起始时间public static long betweenMonth(Date beginDate, Date endDate, boolean isReset)
beginDate - 起始日期endDate - 结束日期isReset - 是否重置时间为起始时间(重置天时分秒)public static long betweenYear(Date beginDate, Date endDate, boolean isReset)
beginDate - 起始日期endDate - 结束日期isReset - 是否重置时间为起始时间(重置月天时分秒)public static String formatBetween(Date beginDate, Date endDate, Fields.Units units)
beginDate - 起始日期endDate - 结束日期units - 级别,按照天、小时、分、秒、毫秒分为5个等级public static String formatBetween(Date beginDate, Date endDate)
beginDate - 起始日期endDate - 结束日期public static String formatBetween(long betweenMs, Fields.Units units)
betweenMs - 日期间隔units - 级别,按照天、小时、分、秒、毫秒分为5个等级public static String formatBetween(long betweenMs)
betweenMs - 日期间隔public static DateTime offsetMillisecond(Date date, int offset)
date - 日期offset - 偏移毫秒数,正数向未来偏移,负数向历史偏移public static DateTime offsetSecond(Date date, int offset)
date - 日期offset - 偏移秒数,正数向未来偏移,负数向历史偏移public static DateTime offsetMinute(Date date, int offset)
date - 日期offset - 偏移分钟数,正数向未来偏移,负数向历史偏移public static DateTime offsetHour(Date date, int offset)
date - 日期offset - 偏移小时数,正数向未来偏移,负数向历史偏移public static DateTime offsetDay(Date date, int offset)
date - 日期offset - 偏移天数,正数向未来偏移,负数向历史偏移public static DateTime offsetWeek(Date date, int offset)
date - 日期offset - 偏移周数,正数向未来偏移,负数向历史偏移public static DateTime offsetMonth(Date date, int offset)
date - 日期offset - 偏移月数,正数向未来偏移,负数向历史偏移public static DateTime offsetYear(Date date, int offset)
date - 日期offset - 偏移月数,正数向未来偏移,负数向历史偏移public static DateTime offset(Date date, Fields.Type type, int offset)
date - 基准日期type - 偏移的粒度大小(小时、天、月等)offset - 偏移量,正数为向后偏移,负数为向前偏移public static String today()
public static long timestamp()
public static long timestamp(boolean isNano)
isNano - 是否为高精度时间public static int thisYear()
public static int thisMonth()
public static int thisWeek()
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()
Copyright © 2021. All rights reserved.