Comparing dates

1
Hi, I've created a retrieve action long time ago like below (where StartProces is an attribute of the entity) [day-from-dateTime(StartProces) = day-from-dateTime('[%CurrentDateTime%]')] [month-from-dateTime(StartProces) = month-from-dateTime('[%CurrentDateTime%]')] [year-from-dateTime(StartProces) = year-from-dateTime('[%CurrentDateTime%]')] But now when i use this code in Mendix 3.2.1 i'm getting the following error in the console: lh: d: An exception has occurred for the following request(s): fn (depth = 0, amount = 1): //ProfitIntergratie.UpdateProfitLog[day-from-dateTime(StartProces) = day-from-dateTime('[%CurrentDateTime%]')] [month-from-dateTime(StartProces) = month-from-dateTime('[%CurrentDateTime%]')] [year-from-dateTime(StartProces) = year-from-dateTime('[%CurrentDateTime%]')] at Shared.Menu_OpenHomePage_Administrator (Retrieve : 'Update log') at Shared.Menu_OpenHomePage_BasedOnRole (SubMicroflow : 'Home page for administrator') Advanced stacktrace: at mA.a(SourceFile:188) Caused by: com.mendix.core.CoreException: d: An exception has occurred for the following request(s): fn (depth = 0, amount = 1): //ProfitIntergratie.UpdateProfitLog[day-from-dateTime(StartProces) = day-from-dateTime('[%CurrentDateTime%]')] [month-from-dateTime(StartProces) = month-from-dateTime('[%CurrentDateTime%]')] [year-from-dateTime(StartProces) = year-from-dateTime('[%CurrentDateTime%]')] at hk.b(SourceFile:170) Caused by: d: An exception has occurred for the following request(s): fn (depth = 0, amount = 1): //ProfitIntergratie.UpdateProfitLog[day-from-dateTime(StartProces) = day-from-dateTime('[%CurrentDateTime%]')] [month-from-dateTime(StartProces) = month-from-dateTime('[%CurrentDateTime%]')] [year-from-dateTime(StartProces) = year-from-dateTime('[%CurrentDateTime%]')] Caused by: d: Exception occurred while retrieving data. (SQL State: S0002, Error Code: 6522) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: A .NET Framework error occurred during execution of user-defined routine or aggregate "mx_toLocalDateTime": System.ArgumentException: Unknown destination time zone name:Custom System.ArgumentException: at Mendix.SqlServerExtensions.DateTimeLocalizer.ConvertToLocalDateTime(SqlDateTime srcDateTime, SqlString dstTimeZoneName) . at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197) at com.microsoft.sqlserver.jdbc.SQLServerResultSet$FetchBuffer.nextRow(SQLServerResultSet.java:4762) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLServerResultSet.java:1682) at com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultSet.java:955) at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207) at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:207) at w.a(SourceFile:353) at w.a(SourceFile:336) at w.a(SourceFile:215) at w.a(SourceFile:165) at w.a(SourceFile:154) at n.a(SourceFile:43) at dt.a(SourceFile:200) at dt.a(SourceFile:158) at dt.a(SourceFile:86) at dx.a(SourceFile:67) at l.a(SourceFile:45) at a.a(SourceFile:249) at ha.b(SourceFile:124) at ha.a(SourceFile:65) at gW.a(SourceFile:60) at gW.executeAction(SourceFile:20) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.retrieveXPathQuery(SourceFile:829) at lJ.a(SourceFile:86) at mA.a(SourceFile:73) at mz.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.executeSync(SourceFile:189) at lp.a(SourceFile:71) at mA.a(SourceFile:73) at mz.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.execute(SourceFile:212) at gz.a(SourceFile:77) at gz.execute(SourceFile:62) at iI.a(SourceFile:311) at iI.a(SourceFile:240) at iI.processRequest(SourceFile:179) at iL.a(SourceFile:71) at com.mendix.core.MxRuntime.processRequest(SourceFile:856) at com.mendix.m2ee.server.handler.RuntimeHandler.handle(RuntimeHandler.java:43) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113) at org.eclipse.jetty.server.Server.handle(Server.java:334) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1007) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:747) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436) at java.lang.Thread.run(Thread.java:662)
asked
1 answers
1

This looks like a bug, a 'Custom' timezone is used when the timezone of the user has not been set. But your database can't deal with this. Can you report this in the support portal?

To fix this, you should set the timezone of this user before attempting queries like these because otherwise it will just use the offset given by the browser which will be incorrect when using it with dates after a daylight savings change.

Also see https://world.mendix.com/display/refguide3/Date+and+Time+Handling+in+3.0

answered