Package cn.longky.common.utils
Class DateTimeUtils
java.lang.Object
cn.longky.common.utils.DateTimeUtils
- Since:
- 1.0
- Author:
- yingzhan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Datestatic DateasDate(LocalDateTime localDateTime) static InstantasInstant(long timestamp) static Instantstatic InstantasInstant(LocalDateTime dateTime) static Instantstatic LocalDateasLocalDate(Long tsMills) static LocalDateasLocalDate(Date date) static LocalDateTimeasLocalDateTime(Long tsMills) static LocalDateTimeasLocalDateTime(Date date) static LongasTimestamp(LocalDate localDate) static LongasTimestamp(LocalDateTime localDateTime) static LongasTimestamp(Date date) static DurationdurationOf(LocalDateTime time) static Stringformat(LocalDateTime dateTime, String pattern) static longstatic longstatic intgetSecondsByDay(int days) static longgetVersionDaily(LocalDate date) static longgetVersionDaily(LocalDateTime dateTime) static longgetVersionTimestamp(LocalDateTime dateTime) static Stringrfc3339Format(LocalDateTime dateTime) static StringsimpleFormat(LocalDateTime dateTime) static Stringstringify(long timeMills) static String序列化时间static String
-
Constructor Details
-
DateTimeUtils
public DateTimeUtils()
-
-
Method Details
-
durationOf
-
asLocalDateTime
-
asLocalDateTime
-
asLocalDate
-
asLocalDate
-
asDate
-
asDate
-
asTimestamp
-
asTimestamp
-
asTimestamp
-
asInstant
-
asInstant
-
asInstant
-
asInstant
-
getSecondsByDay
public static int getSecondsByDay(int days) -
getCurrentVersionDaily
public static long getCurrentVersionDaily() -
getVersionDaily
-
getVersionDaily
-
getCurrentVersionTimestamp
public static long getCurrentVersionTimestamp() -
getVersionTimestamp
-
stringify
序列化时间e.g.
stringify(3601002, TimeUnit.HOURS, TimeUnit.MILLS);return "1时1秒2毫秒"e.g.
stringify(3601002, TimeUnit.HOURS, TimeUnit.SECONDS);return "1时1秒"e.g.
stringify(3601002, TimeUnit.MINUTES, TimeUnit.SECONDS);return "60分1秒"- Parameters:
timeMills- 毫秒数upperPrecision- 精度上限lowerPrecision- 精度下限- Returns:
- 序列化字符串
-
stringify
-
stringify
-
format
-
simpleFormat
-
rfc3339Format
-