I am trying to check Thanksgiving (4th Thursday of November).
I have ZonedDateTime
as 2019-11-23T08:43:14.699-07:00[America/Los_Angeles]
How do I check whether it is4th Thursday or not using java 8 ZonedDateTime
api
In calendar we have Calendar.DAY_OF_WEEK_IN_MONTH
to calculate the week number of in a month. Is there any such thing in ZonedDateTime
?
I have this using calendar.
// check Thanksgiving (4th Thursday of November)
if (cal.get(Calendar.MONTH) == Calendar.NOVEMBER
&& cal.get(Calendar.DAY_OF_WEEK_IN_MONTH) == 4
&& cal.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
return false;
}
How can I achieve this using ZonedDateTime
?