Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java check if date is first Sunday of the Month

I have been looking and searching a lot for this question. I'm really stupid when it comes to using the JAVA Calendar class.

Could anybody please help me to show a simple way of how to get the current time (on the android phone) and check whether is the first Sunday of the month or not.

// Comments in the code examples are very welcome :-)

like image 979
Norfeldt Avatar asked Aug 09 '11 15:08

Norfeldt


1 Answers

Calendar cal = Calendar.getInstance();
if (Calendar.SUNDAY == cal.get(Calendar.DAY_OF_WEEK) && cal.get(Calendar.DAY_OF_MONTH) <= 7)
like image 101
James DW Avatar answered Oct 02 '22 16:10

James DW