Simple java.time.LocalDate examples
Add following imports: import java.time.LocalDate; import java.time.ZoneId; import java.time.format.DateTimeFormatter; Following are examples for displaying date: // Get current LocalDate LocalDate date = LocalDate.now(); // e.g., 28 April 2025 // Format LocalDate DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy"); String formattedDate = date.format(formatter); // "28 April 2025" // Display LocalDate textview2.setText(date.toString()); // Result: "2025-04-28" (ISO format) textview3.setText(formattedDate); // Result: "28 April 2025" // LocalDate of a specific time zone ZoneId zone1 = ZoneId.of("Asia/Kolkata"); // or ZoneId.of("+05:30") LocalDate date2 = LocalDate.now(zone1); textview4.setText(date2.format(formatter)); // Result: "28 April 2025" (same date if system time zone matches, otherwise adjusted) // LocalDate from year, month, and day of month LocalDate date3 = LocalDate....