Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unable to decide on the logic for dates 31 and 30th specifically

843785Feb 6 2009 — edited Feb 6 2009
If I have an order for 31st of every month.
and for the months I do not have 31st, I need to deliver the orders on the 30th,
so I wrote the following for it, but, the problem is,
I look at the tasks in a weekly fashion.
So for ex. If I have created something on May 31st,
then obviously this task should come up on June 30th.
However, the 30th of June would fall between weeks 29th June to 6th July.
and.. I wrote the following and have tried a lot permutations, but am not able to reach to a solution,
I would appreciate any help
         if(((Integer.valueOf(fromDateWeek) <= (Integer.valueOf(orderDate)) 
                   && ((Integer.valueOf(orderDate)))<= Integer.valueOf(toDateWeek)))){ 
                   //sysout("show me the order");
             }else if(((Integer.valueOf(fromDateWeek) <= (Integer.valueOf(orderDate)) 
                   && ((Integer.valueOf(orderDate))) >= Integer.valueOf(toDateWeek)))
                   && (Integer.valueOf(todate)> Integer.valueOf(lastDayinMonth))){
                                      //sysout("show me the order");
             } 
            }
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2009
Added on Feb 6 2009
14 comments
206 views