Skip to content

Commit 3c3cab5

Browse files
authored
add: ts2D (Unix时间戳转Date日期)
1 parent eda7816 commit 3c3cab5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/org/nutz/lang/Times.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,4 +1623,14 @@ public static Date nextHour(Date date, int hour) {
16231623
cal.add(Calendar.HOUR, hour);
16241624
return cal.getTime();
16251625
}
1626+
1627+
/**
1628+
* Unix时间戳转Date日期
1629+
*
1630+
* @param timestamp 时间戳
1631+
* @return 日期
1632+
*/
1633+
public static Date ts2D(long timestamp) {
1634+
return new Date(Long.parseLong(timestamp * 1000 + ""));
1635+
}
16261636
}

0 commit comments

Comments
 (0)