Q: How to make comparisons of dates in WSO2 ESB Proxy Service using filter and xpath I need make a filter with the following condition:
<filter xpath= current-dateTime > ( lastUpdateDate + 30 days ) ...

What is the best way to perform this operation in a proxy service?. As could add 30 days to lastUpdateDate?.
Thanks.

A: You can do this task in filter mediator using script mediator and xpath. When you get the system date to a property as follows,
<property name="date" expression="get-property('SYSTEM_DATE', 'yyyy.MM.dd')" scope="default"/>

then the value of the date would be in "2012.11.23" format. Likewise when 'lastUpdateDate' is defined in that format, the following configuration would create the filter you want;
<script language="js">
    var date = new Date();
    date.setDate(date.getDate()-30);
    var formattedTime = date.getFullYear() + '.' + ("0" + (date.getMonth()+1)).slice(-2) + '.' + ("0" + date.getDate()).slice(-2);  
    mc.setProperty("modifiedDate",formattedTime);
</script>        
<filter xpath="number(translate(get-property('modifiedDate'),'.','')) > number(translate(get-property('lastUpdateDate'),'.',''))">      
    <then>.....

