I am writing a program which gets todays date and yesterday's date. The dates should be business dates. If today is Tuesday then it should furnish yesterday's date which was a Monday. But if today is Monday then it should furnish yesterday's date which was a friday. How to write this program in java. Also the dates which i want should be in Eastern standard time. I dont want GMT. Please help me.
Joined: Oct 14, 2008
Sounds like: create a Calendar object, subtract a day from it, check if it's on a weekend and if so, subtract 1 or 2 days from it depending on whether it's a Saturday or Sunday. The Calendar class has all the methods you'd need for this, and it can handle timezones.
Would you need to consider official holidays as "non-business days"?