You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2025/07/10 09:28:39 UTC

(empire-db) branch master updated: EMPIREDB-471 Remove time from java.util.Date for DATE columns

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

doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git


The following commit(s) were added to refs/heads/master by this push:
     new 3fc5b9f2 EMPIREDB-471 Remove time from java.util.Date for DATE columns
3fc5b9f2 is described below

commit 3fc5b9f267ab62e2111e3f97243307ebc2361ccf
Author: Rainer Döbele <do...@apache.org>
AuthorDate: Thu Jul 10 11:28:36 2025 +0200

    EMPIREDB-471
    Remove time from java.util.Date for DATE columns
---
 empire-db/src/main/java/org/apache/empire/db/DBDatabase.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java b/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java
index 5af5b36b..34ff7659 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBDatabase.java
@@ -36,6 +36,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.empire.commons.DateUtils;
 import org.apache.empire.commons.ObjectUtils;
 import org.apache.empire.commons.Options;
 import org.apache.empire.commons.StringUtils;
@@ -1128,6 +1129,11 @@ public abstract class DBDatabase extends DBObject
                 {   value = ((LocalDateTime)value).toLocalDate();
                     break;
                 }
+                if ((value instanceof Date) && (((Date)value).getTime() % DateUtils.MILLIS_IN_DAY)!=0)
+                {   // remove time
+                    value = DateUtils.getDateOnly((Date)value);
+                    break;
+                }
             case DATETIME:
             case TIMESTAMP:
                 // Check whether value is a valid date/time value!