[rules-users] How to adjust different timezones in drools

Wolfgang Laun wolfgang.laun at gmail.com
Mon Mar 11 03:11:11 EDT 2013


Date literals such as '11-Mar-2013' are parsed and converted at DRL compile
time, which incorporates SimpleDateFormat's knowledge about that
value's TZ into the resulting Date object, which will then be a morsel
of the resulting
Knowledge Base.

I can see two ways:
(1) use a different compiled KB, for each TZ where there are clients
(2) rewrite all comparisons <date-field> <op> <date-literal> using
custom operators for comparing local to client date (which you'll have
to implement)

(1) implies that one running application can only serve clients from
the TZ whose package has been loaded *or* you create multiple sessions
(from a TZ's KB) and direct clients to them accordingly.

(2) You just need a single binary KB. But, again, one session must be
run for some specific TZ, and this must be made known to the
implementation of "lcd" so that the offset can be included, and
clients must be directed as appropriate.

-W




On 11/03/2013, richie <haoruiqian at gmail.com> wrote:
> Hi,
>
> Recently I encountered a problem, my server is in timezone -0700, but the
> client is in timezone +0800, so when client set a condition such as date >=
> '11-Mar-2013', when client is in Mar 11, this condition should return true,
> but maybe the server is still in Mar 10, so the actual result of this
> condition is false, anyway to run out of this?
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-adjust-different-timezones-in-drools-tp4022759.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list