JEXL - Manipulating date and time

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JEXL - Manipulating date and time

Moshe Recanati
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
Loading...