This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
hiiii all, Greetings! I am facing a really weird problem with java Dates. it goes like this: We need to write a function to which we need to pass a java.util.date and we want to get back the due date, which is the day that is after 3 working days if the input time is before 4 PM, and 4 days if it is after 4 PM.to do this we first created a GregorianCalendar instance and added days to it, one at a time, and checked whether this day is a weekend or not. next we checked with the database to see whether this is a company holiday or not. if it passes these tests, then it is a working day. going by this rule, we found out the resultant date. this seems to be working fine as long as the last day "down the calculation lane" is not a sunday. Its only when its a sunday,that the Gregorian Calendar starts behaving creepy....for example if the starting date is 19th august, then the resultant day is shown to be Monday, August 24th,with some valid time,if we set the timezone properly.now, if you just look into any common Paper (may also be plastic :-) ) calendar you will that 24th is Sunday, not Monday!!! i am attaching the codes below, where th function called is TPlus3. Please rescue us!!! Thanks In Advance!!!