DateTime date = new DateTime(2022, 8, 16, 0, 0, 0); int dayOfWeek = date.getDayOfWeek(); System.out.println("Day of the week: " + dayOfWeek); // prints "Day of the week: 2"In this example, we create a DateTime object representing August 16th, 2022 and use the getDayOfWeek() method to get the day of the week, which is Tuesday (represented by the integer value 2). Package/library: org.joda.time.