Java using calendar i want to get date of current weekend, any quick idea
Checking a Weekend using LocalDate The LocalDate. get(ChronoField. DAY_OF_WEEK) method returns an integer value in the range of 1 to 7. Each integer value represents a different weekday.
Get the Day of Week using Calendar (Java 7)Calendar cal = Calendar. getInstance(); cal. setTime(new Date()); int dayOfWeekNum = cal. get(Calendar.
Calendar 's getInstance method returns a Calendar object whose calendar fields have been initialized with the current date and time: Calendar rightNow = Calendar.
Calendar c = Calendar.getInstance();
c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
c.getTime(); // => Date of this coming Saturday.
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