Java LocalDate getDayOfMonth() Method
Example
Get the day of the month:
import java.time.LocalDate;
public class Main {
public static void main(String[] args) {
LocalDate myDate = LocalDate.of(2026, 1, 15);
System.out.println(myDate.getDayOfMonth());
}
}
Definition and Usage
The getDayOfMonth() method returns the day of the month, as a number from 1 to 31.
Tip: Use getDayOfWeek() to find the day of the week, like THURSDAY.
Syntax
public int getDayOfMonth()
Parameter Values
None.
Technical Details
| Returns: | The day of the month, from 1 to 31. |
|---|
Related Pages
❮ Date and Time Methods