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);

android java format date time

import java.time.*; import java.time.format.*; DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); LocalTime time = LocalTime.now(); String output = formatter.format(time);

android java format date time

Similar Code Examples