As far I know, in Java I can get weekdays in normal (Friday) or short mode (Fri). But, there is any way to obtain only first letter?
I thought I can get first letter using "substring", but it won't be correct for all languages. For example, spanish weekdays are: Lunes, Martes, Miércoles, Jueves, Viernes, Sábado and Domingo, and first letter for "Miércoles" is X instead of M to difference it from "Martes".
Format dateFormat = new SimpleDateFormat("EEE, dd/MM/yyyy"); Above, the “EEE” is set to display the name of the day i.e. Monday, Tuesday, Wednesday, etc.
SimpleDateFormat sdf_ = new SimpleDateFormat("EEEE"); Date date = new Date(); String dayName = sdf_. format(date); timeUpdate. setText("" + dayName + " " + currentDate + "");
In Android you can use SimpleDateFormat with "EEEEE". In the next example you can see it.
SimpleDateFormat formatLetterDay = new SimpleDateFormat("EEEEE",Locale.getDefault());
String letter = formatLetterDay.format(new Date());
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