Search code examples
apache-camelsimpledateformat

Apache camel date


I use camel version 2.12.3

I would like to get yesterday date for file name.

Founded documentation from https://camel.apache.org/components/latest/languages/simple-language.html

So i coded like below :

<setProperty propertyName="exportFileName">
            <camel:simple>${date:now-24h:yyyyMMdd}</camel:simple>
</setProperty>

I had this error "java.lang.IllegalArgumentException: Command not supported for dateExpression: now-24h"

Am i missing something here ?

Thanks


Solution

  • Your version is simply too old. This works in current versions of Camel 2.x but not in 2.12.x

    By the way: Notice the version switcher in the Camel component docs in the upper right. You have to switch from latest to 2.x to see the correct docs. However, even the 2.x docs describe the current versions of 2.x and so you would have the same problem in this case :-)