oozie create a parameter with today date

date, oozie, oozie-coordinator

Solution

For the basic EL function , you don't need to add `wf` so it should look like this

<param>DATE=${timestamp()}</param>

If you are using coordinator , than use can simple add new param to wf. it should look something like this

<action>
        <workflow>
            <app-path>${appPath}</app-path>
            <configuration>
                        <property>
                            <name>reportDate</name>
                            <value>${coord:formatTime(coord:dateOffset(coord:nominalTime(), -1,
                                'DAY'), "yyyy-MM-dd")}
                            </value>
                        </property>
              </configuration>
        </workflow>
</action>

Problem

How can I create a parameter with today date of the format : ``` yyyy-mm-dd ``` in oozie. I am passing this variable to hive script which is adding the partition for that date, I found the function to create timestamp using : ``` <param>DATE=${wf:timestamp()}</param> ``` which should return output in the form : ``` (YYYY-MM-DDThh:mm:ss.sZ). I.e.: 1997-07-16T19:20:30.45Z ``` but I am getting error : ``` No function is mapped to the name "wf:timestamp" ``` Also I only want `YYYY-MM-DD` from the timestamp and there is no substring function also which can give me first 10 chars of the string.

Original source