diff --git a/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs b/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs index 16e9990a9..2ed4c46fa 100644 --- a/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs +++ b/dotnet/src/dotnetframework/GxClasses/Core/GXUtilsCommon.cs @@ -3277,7 +3277,16 @@ public static DateTime ServerDate(IGxContext context, IDataStoreProvider dataSto { if (dataStore == null) return ServerDate(context, new DataStoreHelperBase().getDataStoreName()); - return ResetTime(dataStore.serverNow()); + return ResetTimeAndKind(dataStore.serverNow()); + } + + private static DateTime ResetTimeAndKind(DateTime dateTime) + { + if (dateTime.Kind != DateTimeKind.Unspecified) + { + return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0, 0); + } + else return ResetTime(dateTime); } #if !NETCORE [Obsolete("ServerTime with string dataSource is deprecated, use ServerTime(IGxContext context, Data.NTier.IDataStoreProvider dataStore) instead", false)] diff --git a/dotnet/src/dotnetframework/GxClasses/Data/GXDataCommon.cs b/dotnet/src/dotnetframework/GxClasses/Data/GXDataCommon.cs index d3b589655..9d6cd66b0 100644 --- a/dotnet/src/dotnetframework/GxClasses/Data/GXDataCommon.cs +++ b/dotnet/src/dotnetframework/GxClasses/Data/GXDataCommon.cs @@ -1169,6 +1169,11 @@ public virtual string AfterCreateCommand(string stmt, GxParameterCollection parm { return stmt; } + + internal virtual DateTime NormalizeDbmsDateTime(DateTime d) + { + return d; + } } public class DbDataAdapterElem diff --git a/dotnet/src/dotnetframework/GxClasses/Data/GXDataNTier.cs b/dotnet/src/dotnetframework/GxClasses/Data/GXDataNTier.cs index 5b22c2db2..85160517e 100644 --- a/dotnet/src/dotnetframework/GxClasses/Data/GXDataNTier.cs +++ b/dotnet/src/dotnetframework/GxClasses/Data/GXDataNTier.cs @@ -752,10 +752,11 @@ public DateTime serverNow() public DateTime serverNowIn(bool hasMilliseconds ) { string stmt = ""; + GxDataRecord gxDataRecord = (GxDataRecord)_ds.Db; if (hasMilliseconds) - stmt = ((GxDataRecord)_ds.Db).GetServerDateTimeStmtMs(_ds.Connection); + stmt = gxDataRecord.GetServerDateTimeStmtMs(_ds.Connection); else - stmt = ((GxDataRecord)_ds.Db).GetServerDateTimeStmt(_ds.Connection); + stmt = gxDataRecord.GetServerDateTimeStmt(_ds.Connection); if (string.IsNullOrEmpty(stmt)) { diff --git a/dotnet/src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs b/dotnet/src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs index b3eda3e4d..2835a4ec5 100644 --- a/dotnet/src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs +++ b/dotnet/src/dotnetframework/GxClasses/Data/GXDataPostgreSQL.cs @@ -631,6 +631,14 @@ public override string ConcatOp(int pos) { return ConcatOpValues[pos]; } + internal override DateTime NormalizeDbmsDateTime(DateTime d) + { + if (d.Kind != DateTimeKind.Unspecified) + { + d = new DateTime(d.Year, d.Month, d.Day, d.Hour, d.Minute, d.Second, d.Millisecond); + } + return d; + } } sealed internal class PostgresqlConnectionWrapper : GxAbstractConnectionWrapper {