picaso
picaso

Reputation: 703

Check day of week in Android

I want to check if the current day of the week is Sunday or not. How can I find it out? I am using this in alarm activity. Please help me. I want to setup an alarm which does not work on Sunday. Thanks in advance.

Upvotes: 2

Views: 1629

Answers (1)

caguilar187
caguilar187

Reputation: 763

use the calendar class to check that information.

 Calendar rightNow = Calendar.getInstance();
 int day = rightNow.get(Calendar.DAY_OF_WEEK);
 if(day==Calendar.SUNDAY){
   //its sunday
 }

Upvotes: 9

Related Questions