You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rc...@apache.org on 2020/05/04 10:01:51 UTC

[james-project] 04/14: [Refactoring] simplify conversion to from Date to Instant

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 4d69f39985792e421255996e0e7dd92982e09c58
Author: Matthieu Baechler <ma...@apache.org>
AuthorDate: Tue Apr 28 21:30:21 2020 +0200

    [Refactoring] simplify conversion to from Date to Instant
---
 .../james/mailbox/elasticsearch/query/DateResolutionFormatter.java     | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/query/DateResolutionFormatter.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/query/DateResolutionFormatter.java
index 0f88ba2..9528cc0 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/query/DateResolutionFormatter.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/query/DateResolutionFormatter.java
@@ -19,7 +19,6 @@
 
 package org.apache.james.mailbox.elasticsearch.query;
 
-import java.time.Instant;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
 import java.time.temporal.ChronoUnit;
@@ -65,6 +64,6 @@ public class DateResolutionFormatter {
     }
 
     public static ZonedDateTime convertDateToZonedDateTime(Date date) {
-        return ZonedDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());
+        return ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
     }
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org