This is my Java code to find the current month/date we are in:
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class GetCurrentDateTime {
private static final DateFormat sdf = new SimpleDateFormat("MM-dd");
public static void main(String[] args) {
Date date = new Date();
System.out.println(sdf.format(date));
}
}
I want this code to do something else. When the code finds the month we are in, I also want it to find the month length. Result should be like this:
08-16
31
Can you help me with this? Thank you.