Search code examples
esper

Esper EPL Online Date format


I'm trying to use the Esper EPL Online console and I don't know how to use Dates in the Time And Event Sequence. For example, I have a schema defined like this:

create schema EventCreated(
  source String,
  type String,
  time Date
);

And I'm trying to add an event in the Time And Event Sequence, for example like this:

EventCreated = {
    source = 'tracker1',
    type = 'c8y_ObdConnectionReport',
    time =  '2016-10-07T10:00:00.000'
}

But of course this doesn't work. I tried using "new Date()" or [com.espertech.esper.client.util.]DateTime.parseDefaultDate() but I can't make it work.


Solution

  • There is an "eval" for evaluating EPL expressions.

    StockTick={time=eval('com.espertech.esper.client.util.DateTime.parseDefaultDate("2016-10-07T10:00:00.000")')}
    

    It would be nice though if the tool would just take the string and make it a date.