jdk/src/share/classes/java/util/Calendar.java
changeset 15658 55b829ca2334
parent 15280 d9e473e85f3c
child 16010 2727163b5df5
--- a/jdk/src/share/classes/java/util/Calendar.java	Tue Feb 12 16:02:14 2013 +0400
+++ b/jdk/src/share/classes/java/util/Calendar.java	Tue Feb 12 09:25:43 2013 -0800
@@ -51,6 +51,7 @@
 import java.security.ProtectionDomain;
 import java.text.DateFormat;
 import java.text.DateFormatSymbols;
+import java.time.Instant;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import sun.util.BuddhistCalendar;
@@ -3562,4 +3563,17 @@
             }
         }
     }
+
+    /**
+     * Converts this object to an {@link Instant}.
+     * <p>
+     * The conversion creates an {@code Instant} that represents the
+     * same point on the time-line as this {@code Calendar}.
+     *
+     * @return the instant representing the same point on the time-line
+     * @since 1.8
+     */
+    public final Instant toInstant() {
+        return Instant.ofEpochMilli(getTimeInMillis());
+    }
 }