[JAVA] How to get today's day of the week

How to get the day of the week

Day of the week

String [] weekName = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Calendar calendar = Calendar.getInstance();

    int week = calendar.get(Calendar.DAY_OF_WEEK) - 1;
    Log.v("checkCalendor"," + " + weekName[week]);

}

How to get other information

int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
int day = calendar.get(Calendar.DATE);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
int second = calendar.get(Calendar.SECOND);
int week = calendar.get(Calendar.DAY_OF_WEEK) - 1;

Recommended Posts

How to get today's day of the week
[Java] Get the day of the specific day of the week
I want to output the day of the week
[Ruby] Code to display the day of the week
[Java] How to get the authority of the folder
[Java] How to get the URL of the transition source
[Java] How to get the maximum value of HashMap
[Android] How to get the setting language of the terminal
[Rails] How to get the contents of strong parameters
[Swift] How to get the document ID of Firebase
How to get the longest information from Twitter as of 12/12/2016
[Ruby] Display today's day of the week using Date class
How to derive the last day of the month in Java
[jsoup] How to get the full amount of a document
[Ruby] I want to make a program that displays today's day of the week!
[Java] How to display the day of the week acquired by LocalDate, DateTimeformatter in Japanese
How to determine the number of parallels
[Java] How to get the current directory
How to sort the List of SelectItem
How to get the date in java
[Rails] How to get the URL of the transition source and redirect
[Java1.8 +] Get the date of the next x day of the week with LocalDate
[Swift5] How to get an array and the complement of arrays
[Swift UI] How to get the startup status of the application [iOS]
How to get the contents of Map using for statement Memorandum
How to get the id of PRIMAY KEY auto_incremented in MyBatis
How to get the length of an audio file in java
How to find the cause of the Ruby error
Zeller's official (asking for the day of the week)
Customize how to divide the contents of Recyclerview
Output of how to use the slice method
[Java] How to get to the front of a specific string using the String class
How to display the result of form input
How to get the absolute path of a directory running in Java
[Java] How to get the redirected final URL
[Swift] How to get the number of elements in an array (super basic)
graphql-ruby: How to get the name of query or mutation in controller Note
How to get the ID of a user authenticated with Firebase in Swift
[Java] How to easily get the longest character string of ArrayList using stream
[Ubuntu 20.04] Display the day of the week on the date / clock
How to delete / update the list field of OneToMany
How to write Scala from the perspective of Java
[Ruby] How to find the sum of each digit
How to install the root certificate of Centos7 (Cybertrust)
[Rails] How to change the column name of the table
[SwiftUI] How to specify the abbreviated position of Text
As of April 2018 How to get Java 8 on Mac
Output of the day of the week using Ruby's Date class
How to judge the click of any area of the image
How to download the old version of Apache Tomcat
[Ruby] How to get the tens place and the ones place
How to get the class name of the argument of LoggerFactory.getLogger when using SLF4J in Java
How to get the class name / method name running in Java
An unsupported Java version How to get rid of errors
How to display the select field of time_select every 30 minutes
Get to the abbreviations from 5 examples of iterating Java lists
[IOS] How to get the table name from AWS DynamoDB
How to change the setting value of Springboot Hikari CP
[Ruby] How to retrieve the contents of a double hash
How to add elements without specifying the length of the array
Let's summarize how to extend the expiration date of Rails