We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c710029 commit d6714d8Copy full SHA for d6714d8
1 file changed
java8-datetime-api/src/main/java/io/github/biezhi/datetime/ClockExample.java
@@ -0,0 +1,23 @@
1
+package io.github.biezhi.datetime;
2
+
3
+import java.time.Clock;
4
+import java.time.Instant;
5
+import java.util.Date;
6
7
+/**
8
+ * Clock 示例
9
+ *
10
+ * @author biezhi
11
+ * @date 2018/3/3
12
+ */
13
+public class ClockExample {
14
15
+ public static void main(String[] args) {
16
+ Clock clock = Clock.systemDefaultZone();
17
+ long millis = clock.millis();
18
+ Instant instant = clock.instant();
19
+ Date legacyDate = Date.from(instant); // legacy java.util.Date
20
+ System.out.println(millis);
21
+ System.out.println(legacyDate);
22
+ }
23
+}
0 commit comments