public class Dates8 extends Object
Modifier and Type | Field and Description |
---|---|
static long |
DAY_STAMP |
static ZoneOffset |
DEFAULT_ZERO_ZONE_OFFSET |
static ZoneId |
DEFAULT_ZONE_ID |
static ZoneOffset |
DEFAULT_ZONE_OFFSET |
static String |
HMS |
static String |
HMSS |
static long |
HOUR_STAMP |
static String |
MD |
static String |
MD_HM |
static String |
MD_HMS |
static long |
MINUTE_STAMP |
static long |
MONTH_STAMP |
static String[] |
PARSE_PATTERN_GROUP1 |
static String[] |
PARSE_PATTERN_GROUP2 |
static String[] |
PARSE_PATTERN_GROUP3 |
static long |
SECOND_STAMP |
static long |
WEEK_STAMP |
static String |
WORLD |
static long |
YEAR_STAMP |
static String |
YM |
static String |
YM1 |
static String |
YM2 |
static String |
YMD |
static String |
YMD_HM |
static String |
YMD_HM1 |
static String |
YMD_HM2 |
static String |
YMD_HMS |
static String |
YMD_HMS1 |
static String |
YMD_HMS2 |
static String |
YMD_HMSS |
static String |
YMD_HMSS1 |
static String |
YMD_HMSS2 |
static String |
YMD1 |
static String |
YMD2 |
Modifier and Type | Method and Description |
---|---|
static LocalDateTime |
clearDay(LocalDateTime d) |
static LocalDateTime |
clearDayHms(LocalDateTime d) |
static LocalDateTime |
clearHms(LocalDateTime d) |
static Date |
date(Instant instant) |
static Date |
date(LocalDate d) |
static Date |
date(LocalDateTime d) |
static Date |
date(LocalDateTime d,
ZoneOffset offset) |
static Date |
date(LocalDate d,
ZoneOffset offset) |
static String |
format(TemporalAccessor d) |
static String |
format(TemporalAccessor d,
String pattern)
格式化时间
|
static int |
getMonthLastDay(int year,
int month)
获得月份的最后一天
|
static int |
getQuarter(int month)
获取季度
|
static long |
getSecondTime(long timestamp)
时间戳毫秒转时间戳秒
|
static String |
hourType(int hour)
时间段
|
static boolean |
inFuture(long time)
判断时间是否在未来
|
static Instant |
instant() |
static Instant |
instant(Date date) |
static Instant |
instant(LocalDate d) |
static Instant |
instant(LocalDateTime dt) |
static Instant |
instant(LocalDateTime dt,
ZoneOffset offset) |
static Instant |
instant(LocalDate d,
ZoneOffset offset) |
static Instant |
instant(long ms)
获取 Instant
|
static String |
interval(long ms) |
static String |
interval(long ms,
boolean full) |
static String |
interval(long ms,
boolean full,
String day,
String hour,
String minute,
String second)
时差
|
static long[] |
intervalAnalysis(long ms)
时差解构
|
static boolean |
isDateClass(Class<?> c)
判断对象是否为时间格式 不包含String
|
static boolean |
isExpired(LocalDateTime time)
时间是否已过期
|
static boolean |
isExpired(long time)
时间是否已过期
|
static boolean |
isLeapYear(int year)
是否为闰年
|
static boolean |
isMilli(long l)
是否是时间戳毫秒
|
static LocalDate |
localDate() |
static LocalDate |
localDate(Date date) |
static LocalDate |
localDate(Date date,
ZoneId zoneId) |
static LocalDate |
localDate(Instant instant) |
static LocalDate |
localDate(Instant instant,
ZoneId zoneId) |
static LocalDate |
localDate(int year,
int month,
int day) |
static LocalDate |
localDate(LocalDateTime d) |
static LocalDate |
localDate(long ms) |
static LocalDate |
localDate(long ms,
ZoneOffset offset) |
static LocalDate |
localDate(Object o)
将对象转化为 LocalDate
|
static LocalDateTime |
localDateTime() |
static LocalDateTime |
localDateTime(Date date) |
static LocalDateTime |
localDateTime(Date date,
ZoneId zoneId) |
static LocalDateTime |
localDateTime(Instant instant) |
static LocalDateTime |
localDateTime(Instant instant,
ZoneId zoneId) |
static LocalDateTime |
localDateTime(int year,
int month,
int day) |
static LocalDateTime |
localDateTime(int year,
int month,
int day,
int h,
int m,
int s) |
static LocalDateTime |
localDateTime(int year,
int month,
int day,
int h,
int m,
int s,
int ms) |
static LocalDateTime |
localDateTime(LocalDate d) |
static LocalDateTime |
localDateTime(LocalDate d,
LocalTime t) |
static LocalDateTime |
localDateTime(long ms) |
static LocalDateTime |
localDateTime(long ms,
ZoneOffset offset) |
static LocalDateTime |
localDateTime(Object o)
将对象转化为 LocalDateTime
|
static LocalTime |
localTime() |
static LocalTime |
localTime(Date date) |
static LocalTime |
localTime(Date date,
ZoneId zoneId) |
static LocalTime |
localTime(Instant instant) |
static LocalTime |
localTime(Instant instant,
ZoneId zoneId) |
static LocalTime |
localTime(int h,
int m,
int s) |
static LocalTime |
localTime(int h,
int m,
int s,
int nano) |
static LocalTime |
localTime(LocalDateTime d) |
static LocalTime |
localTime(long ms) |
static LocalTime |
localTime(long ms,
int nano) |
static LocalTime |
localTime(long ms,
int nano,
ZoneOffset offset) |
static LocalTime |
localTime(long ms,
ZoneOffset offset) |
static String |
pad(int year,
int month,
int day) |
static String |
pad(int year,
int month,
int day,
int hour,
int minute,
int second) |
static String |
pad(int year,
int month,
int day,
int hour,
int minute,
int second,
int milli)
填充时间
|
static TemporalAccessor |
parse(String d) |
static TemporalAccessor |
parse(String d,
String pattern)
日期转化
|
static long |
timestamp() |
static long |
timestamp(Date date) |
static long |
timestamp(Instant instant) |
static long |
timestamp(LocalDate d) |
static long |
timestamp(LocalDateTime d) |
static long |
timestamp(LocalDateTime d,
ZoneOffset offset) |
static long |
timestamp(LocalDate d,
ZoneOffset offset) |
public static final String WORLD
public static final String YM
public static final String MD
public static final String MD_HM
public static final String MD_HMS
public static final String YMD
public static final String YMD_HM
public static final String YMD_HMS
public static final String YMD_HMSS
public static final String HMS
public static final String HMSS
public static final String YM1
public static final String YMD1
public static final String YMD_HM1
public static final String YMD_HMS1
public static final String YMD_HMSS1
public static final String YM2
public static final String YMD2
public static final String YMD_HM2
public static final String YMD_HMS2
public static final String YMD_HMSS2
public static final String[] PARSE_PATTERN_GROUP1
public static final String[] PARSE_PATTERN_GROUP2
public static final String[] PARSE_PATTERN_GROUP3
public static final long WEEK_STAMP
public static final long YEAR_STAMP
public static final long MONTH_STAMP
public static final long DAY_STAMP
public static final long HOUR_STAMP
public static final long MINUTE_STAMP
public static final long SECOND_STAMP
public static final ZoneId DEFAULT_ZONE_ID
public static final ZoneOffset DEFAULT_ZONE_OFFSET
public static final ZoneOffset DEFAULT_ZERO_ZONE_OFFSET
public static LocalDateTime localDateTime(Object o)
o
- 对象public static LocalDate localDate(Object o)
o
- 对象public static Instant instant()
public static Instant instant(long ms)
ms
- 时间戳毫秒public static Instant instant(LocalDate d, ZoneOffset offset)
public static Instant instant(LocalDateTime dt)
public static Instant instant(LocalDateTime dt, ZoneOffset offset)
public static long timestamp()
public static long timestamp(Date date)
public static long timestamp(Instant instant)
public static long timestamp(LocalDate d)
public static long timestamp(LocalDate d, ZoneOffset offset)
public static long timestamp(LocalDateTime d)
public static long timestamp(LocalDateTime d, ZoneOffset offset)
public static Date date(LocalDate d, ZoneOffset offset)
public static Date date(LocalDateTime d)
public static Date date(LocalDateTime d, ZoneOffset offset)
public static LocalDate localDate()
public static LocalDate localDate(int year, int month, int day)
public static LocalDate localDate(long ms)
public static LocalDate localDate(long ms, ZoneOffset offset)
public static LocalDate localDate(LocalDateTime d)
public static LocalTime localTime()
public static LocalTime localTime(int h, int m, int s)
public static LocalTime localTime(int h, int m, int s, int nano)
public static LocalTime localTime(long ms, int nano)
public static LocalTime localTime(long ms, int nano, ZoneOffset offset)
public static LocalTime localTime(long ms)
public static LocalTime localTime(long ms, ZoneOffset offset)
public static LocalTime localTime(LocalDateTime d)
public static LocalDateTime localDateTime()
public static LocalDateTime localDateTime(int year, int month, int day)
public static LocalDateTime localDateTime(int year, int month, int day, int h, int m, int s)
public static LocalDateTime localDateTime(int year, int month, int day, int h, int m, int s, int ms)
public static LocalDateTime localDateTime(long ms)
public static LocalDateTime localDateTime(long ms, ZoneOffset offset)
public static LocalDateTime localDateTime(Date date)
public static LocalDateTime localDateTime(Date date, ZoneId zoneId)
public static LocalDateTime localDateTime(Instant instant)
public static LocalDateTime localDateTime(Instant instant, ZoneId zoneId)
public static LocalDateTime localDateTime(LocalDate d)
public static LocalDateTime localDateTime(LocalDate d, LocalTime t)
public static LocalDateTime clearHms(LocalDateTime d)
public static LocalDateTime clearDay(LocalDateTime d)
public static LocalDateTime clearDayHms(LocalDateTime d)
public static String format(TemporalAccessor d)
public static String format(TemporalAccessor d, String pattern)
d
- 时间pattern
- patternpublic static TemporalAccessor parse(String d)
public static TemporalAccessor parse(String d, String pattern)
d
- ignorepattern
- patternpublic static boolean isExpired(LocalDateTime time)
time
- timepublic static boolean isDateClass(Class<?> c)
c
- cpublic static boolean isMilli(long l)
l
- ignorepublic static long getSecondTime(long timestamp)
timestamp
- 时间戳毫秒public static String hourType(int hour)
hour
- 小时public static boolean isExpired(long time)
time
- timepublic static boolean inFuture(long time)
time
- timepublic static String interval(long ms)
public static String interval(long ms, boolean full)
public static String interval(long ms, boolean full, String day, String hour, String minute, String second)
ms
- 时间戳毫秒full
- 为0是否显示 0天0时0分1秒 : 1秒day
- 天显示的文字hour
- 时显示的文字minute
- 分显示的文字second
- 秒显示的文字public static long[] intervalAnalysis(long ms)
ms
- 时间戳毫秒public static boolean isLeapYear(int year)
year
- 年public static int getMonthLastDay(int year, int month)
year
- 年份month
- 月份public static int getQuarter(int month)
month
- monthpublic static String pad(int year, int month, int day)
public static String pad(int year, int month, int day, int hour, int minute, int second)
public static String pad(int year, int month, int day, int hour, int minute, int second, int milli)
year
- yearmonth
- monthday
- dayhour
- hourminute
- minutesecond
- secondmilli
- milliCopyright © 2024. All rights reserved.