checking a day
Posted on 2013-05-24
we have a java class which invokes a sql and passes the FROM_DATE and TO_DATE to the sql.
The logic to calcualte FROM_DATE and TO_DATE is as follows ::
If the java class is run on a Friday get the Date, example 2013-05-24 and assign it to TO_DATE
FROM_DATE = TO_DATE - 5 days (which is the monday for that week), so FROM_DATE will be 2013-05-20
If the java class is run AFTER friday
calculate previous friday as TO_DATE
FROM_DATE = TO_DATE - 5 days (which is the monday for that week)
Finally my FROM_DATE and TO_DATE should return values something like this
2013-05-20 2013-05-24 (for this week)
2013-05-27 2013-05-31 (for next week)
2013-06-03 2013-06-07 (and so on..)
Any idea how i can accomplish this?