Index: /trunk/src/org/openstreetmap/josm/io/GpxWriter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/GpxWriter.java	(revision 17721)
+++ /trunk/src/org/openstreetmap/josm/io/GpxWriter.java	(revision 17722)
@@ -9,4 +9,5 @@
 import java.io.PrintWriter;
 import java.nio.charset.StandardCharsets;
+import java.time.Instant;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -170,5 +171,7 @@
                     Object val = obj.get(key);
                     if (val instanceof Date) {
-                        simpleTag(key, DateUtils.fromDate((Date) val));
+                        throw new IllegalStateException();
+                    } else if (val instanceof Instant) {
+                        simpleTag(key, String.valueOf(val));
                     } else if (val instanceof Number) {
                         simpleTag(key, val.toString());
Index: /trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java	(revision 17721)
+++ /trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java	(revision 17722)
@@ -7,4 +7,5 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.time.Instant;
 import java.time.LocalDate;
 import java.time.Month;
@@ -44,4 +45,5 @@
         GpxData gpx = new GpxData();
         WayPoint waypoint = new WayPoint(LatLon.ZERO);
+        waypoint.setInstant(Instant.parse("2019-06-08T08:23:12.300Z"));
         consumer.accept(waypoint);
         gpx.addWaypoint(waypoint);
@@ -89,4 +91,5 @@
                     w.put(GpxConstants.PT_PDOP, 1.2);
                 },
+                "    <time>2019-06-08T08:23:12.300Z</time>\n" +
                 "    <sat>16</sat>\n" +
                 "    <hdop>0.7</hdop>\n" +
