Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_MONTH, 1);
System.out.println("First day of the current month:-"+c.getTime());
Java -8 (using java.time)
LocalDate currentDate = LocalDate.now();
System.out.println("First day of the current month:-" + currentDate.withDayOfMonth(1));
No comments:
Post a Comment