Ay123
Ay123

Reputation: 55

Returning previous business day instead of currentDate with fastDateFormat

I currently have the below code utilized for retrieving current date in spring batch. Is there a way to implement a similar solution, but instead, returning the previous business day instead of the currentDate?

<bean id="fastDateFormat" class="org.apache.commons.lang.time.FastDateFormat"
    factory-method="getInstance">
    <constructor-arg value="yyyyMMdd" />
</bean>

<bean id="currentDate" class="java.util.Date" factory-bean="fastDateFormat"
    factory-method="format">
    <constructor-arg>
        <bean class="java.util.Date" />
    </constructor-arg>
</bean>

Upvotes: 0

Views: 30

Answers (1)

httPants
httPants

Reputation: 2143

Using natty you can parse natural language date expressions like "yesterday" or "24 hours before now" to generate a java.util.Date object.

Upvotes: 0

Related Questions