Class: LocalDate
Represents a date without a time-zone in the ISO-8601 calendar system. This is an abstract class and cannot be instantiated directly.
Abstract
Properties
dayOfMonth
dayOfMonth: int
The day of the month, from 1 to 31.
Example
date = LocalDate.of(2023, 9, 15)
print(date.dayOfMonth) # Output: 15
dayOfWeek
dayOfWeek: int
The day of the week, from 1 (Monday) to 7 (Sunday).
Example
date = LocalDate.of(2023, 9, 15) # September 15, 2023 is a Friday
print(date.dayOfWeek) # Output: 5
dayOfYear
dayOfYear: int
The day of the year, from 1 to 365 (or 366 in a leap year).
Example
date = LocalDate.of(2023, 9, 15)
print(date.dayOfYear) # Output: 258 (as September 15 is the 258th day of 2023)
month
month: int
The month of the year, from 1 (January) to 12 (December).
Example
date = LocalDate.of(2023, 9, 15)
print(date.month) # Output: 9
year
year: int
The year.
Example
date = LocalDate.of(2023, 9, 15)
print(date.year) # Output: 2023
Methods
add()
add(duration: Duration) -> LocalDate
Adds a specified duration to this date.
Parameters
- duration: Duration - The duration to add.
Returns
LocalDate - A new LocalDate representing the result.