0
I need to convert the number that corresponds to the day of the week in String of the day in Java. Ex:
0 => Monday
1 => Tuesday
0
I need to convert the number that corresponds to the day of the week in String of the day in Java. Ex:
0 => Monday
1 => Tuesday
11
You can use the DayOfWeek
for this, example:
import java.time.DayOfWeek;
public class Main {
public static void main (String[] args) {
System.out.println("1 = " + DayOfWeek.of(1));
System.out.println("2 = " + DayOfWeek.of(2));
System.out.println("3 = " + DayOfWeek.of(3));
System.out.println("4 = " + DayOfWeek.of(4));
System.out.println("5 = " + DayOfWeek.of(5));
System.out.println("6 = " + DayOfWeek.of(6));
System.out.println("7 = " + DayOfWeek.of(7));
}
}
See working on repl it.
You can see a few more examples: Dayofweek and Month Enums
Browser other questions tagged java
You are not signed in. Login or sign up in order to post.
I mean, you want weeks starting on Monday?
– Victor Stafusa