date time formating android studio\ code example
Example 1: android java format date time
import java.time.*;
import java.time.format.*;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime datetime = LocalDateTime.now();
String output = formatter.format(datetime);
Example 2: android java format date time
import java.time.*;
import java.time.format.*;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate date = LocalDate.now();
String output = formatter.format(date);