0

Possible Duplicate:
What is the easiest way to get the current day of the week in Android?

I want to make an app with the question: "Is it al Friday?" And than you would see "No" or "Yes" if it's Friday. So my question is: How can i check if today it's friday? I hope you understand me, otherwise just ask me.

Gaauwe

Community
  • 1
  • 1
Gaauwe
  • 281
  • 2
  • 8
  • 18

3 Answers3

3

You should use the java.util.Calendar class.

Quoting the documentation :

Calendar rightNow = Calendar.getInstance();
if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY){
   //do some stuff here
}
Laurent'
  • 2,611
  • 1
  • 14
  • 22
0

see this: http://developer.android.com/reference/java/util/Date.html u probably want to create a calendar instance & set it to the current date and get the day of the week(Calendar.DAY_OF_WEEK) & compare with friday(friday = 6 if i remember correctly?,check on this pls) or use new date()....

con_9
  • 2,491
  • 3
  • 23
  • 31
0

Simply this:

    private boolean isTodayFriday(){
    Calendar calendar = Calendar.getInstance();
    return calendar.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY;
}
Jordy Langen
  • 3,591
  • 4
  • 23
  • 32