I have date string 18-2-2012 , from this how to get the current day name i.e., today is "saturday" like this. for tomorrow's date 19-2-2012 and the day name is "sunday".
getInstance(). getTime(); System. out. println("Current time => " + c); SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy"); String formattedDate = df.
SimpleDateFormat sdf_ = new SimpleDateFormat("EEEE"); Date date = new Date(); String dayName = sdf_. format(date); timeUpdate. setText("" + dayName + " " + currentDate + "");
This example demonstrates how to get the current time and date in an Android app Kotlin. Step 1 − Create a new project in Android Studio, go to File ⇉ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.
get(Calendar. DAY_OF_MONTH) + 1; will it display tomorrow's date. or just add one to today's date? For example, if today is January 31.
Use java date formats.
SimpleDateFormat inFormat = new SimpleDateFormat("dd-MM-yyyy"); Date date = inFormat.parse(input); SimpleDateFormat outFormat = new SimpleDateFormat("EEEE"); String goal = outFormat.format(date);
You can use Calendar
Calendar calendar = Calendar.getInstance(); calendar.setTime(date_your_want_to_know); String[] days = new String[] { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" } String day = days[calendar.get(Calendar.DAY_OF_WEEK)];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With