Skip to content

Commit

Permalink
v1.1.5
Browse files Browse the repository at this point in the history
update DateUtil
  • Loading branch information
lemos1235 committed Sep 20, 2023
1 parent 906852d commit 787b0cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>club.lemos</groupId>
<artifactId>jtool</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
<packaging>jar</packaging>
<name>jtool</name>

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/club/lemos/common/utils/DateUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,16 @@ public static LocalDateTime fromMilliseconds(final long milliseconds) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(milliseconds), ZoneId.systemDefault());
}

/**
* 转换成java8 时间
*
* @param seconds 秒数
* @return LocalDateTime
*/
public static LocalDateTime fromSeconds(final long seconds) {
return LocalDateTime.ofInstant(Instant.ofEpochMilli(seconds * 1000), ZoneId.systemDefault());
}

/**
* 比较2个时间差,跨度比较小
*
Expand Down

0 comments on commit 787b0cb

Please sign in to comment.