Is there a way to check if a java Date
object is Monday? I see you can with a Calendar
object, but date? I\'m also using US-eastern date and time if th
The question doesn't make sense without two extra pieces of information: a time zone and a calendar system.
A Date
object just represents an instant in time. It happens to be Wednesday in the Gregorian calendar in my time zone - but for some folks to the east of me, it's already Thursday. In other calendar systems, there may not even be such a concept of "Monday" etc.
The calendar system part is probably not a problem, but you will need to work out which time zone you're interested in.
You can then create a Calendar
object and set both the time zone and the instant represented - or, better, you could use Joda Time which is a much better date/time API. You'll still need to think about the same questions, but your code will be clearer.