commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moshe Recanati <re.mo...@gmail.com>
Subject JEXL - Manipulating date and time
Date Sat, 05 Aug 2017 22:23:25 GMT
Hi,
I would like to use JEXL expression to deal with Date or Time variables in
my expression.
For example:
String expression = "if (timeNow < \"19:30:00 IDT\") result=2 else result =
0";

While context is:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY,19);
cal.set(Calendar.MINUTE,30);
cal.set(Calendar.SECOND,0);
cal.set(Calendar.MILLISECOND,0);

Date d = cal.getTime();
jexlContext.set("timeNow", d);

I would like to know how to implement it since currently it's returning
wrong eval data.

Thank you in advance,
Moshe

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message