File tree Expand file tree Collapse file tree
src/main/java/org/opentripplanner/ojp/time Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import java .time .ZoneId ;
55import java .time .ZonedDateTime ;
66import java .time .format .DateTimeFormatter ;
7+ import java .time .temporal .ChronoUnit ;
78import java .util .Objects ;
89
910/**
@@ -23,6 +24,13 @@ public XmlDateTime(LocalDateTime localDateTime) {
2324 this .localDateTime = Objects .requireNonNull (localDateTime );
2425 }
2526
27+ /**
28+ * Return a truncated version of the given date time with millisecond precision.
29+ */
30+ public static XmlDateTime truncatedToMillis (ZonedDateTime dateTime ) {
31+ return new XmlDateTime (dateTime .truncatedTo (ChronoUnit .MILLIS ));
32+ }
33+
2634 /**
2735 * Converts the abstract XML dateTime into a {@link ZonedDateTime}. If the underlying date time
2836 * was already zoned, then it is converted to the same instant but in the specified zone.
You can’t perform that action at this time.
0 commit comments