Possible duplicate:What is the easiest way to get the current day of the week in Android?
I want to make an application with the question: "Is it Friday?" And by what you will see βNoβ or βYesβ if on Friday. So my question is: How can I check if it is Friday today? I hope you understand me, otherwise just ask me.
Gauwe
You should use the java.util.Calendar class.
Indication of documentation:
Calendar rightNow = Calendar.getInstance(); if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY){ //do some stuff here }
see this: http://developer.android.com/reference/java/util/Date.html u probably want to create an instance of the calendar and set it to the current date and get the day of the week (Calendar.DAY_OF_WEEK) and compare with Friday (friday = 6, if I remember correctly ?, check this pls) or use the new date () ....
This is simple:
private boolean isTodayFriday(){ Calendar calendar = Calendar.getInstance(); return calendar.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY; }
Source: https://habr.com/ru/post/922432/More articles:colorise single track in kml file - kmlHow to capture a network packet in Android without using any root rights - androidPG :: Error: SSL error SYSCALL: EOF detected - ruby-on-rails-3Is it possible to create a background thread in Slime (Swank Emacs) - emacsAndroid countdown timer to date - javaASP.NET Web API Model Binding - asp.net-mvcvector.push_back rvalue and copy-elision - c ++Cross compiling on Linux from OS X - gccHow to register a custom module model in MVC4 RC WebApi - c #Is font size preferable in Windows8 for calculator? - fontsAll Articles