Time
SimpleDateFormat
Section titled “SimpleDateFormat”var currentTime by remember { mutableStateOf("") }
LaunchedEffect(Unit) { while (true) { currentTime = SimpleDateFormat("HH:mm", Locale.getDefault()).format(Date()) delay(1000L) }}DateTimeFormatter
Section titled “DateTimeFormatter”LocalDateTime.now().format( DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm:ss" ))val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss")val parsed = LocalDateTime.parse("12/04/2026 14:30:00", formatter) // skip formatter if parse source is ISO timeval millis = parsed .atZone(ZoneId.systemDefault()) .toInstant() .toEpochMilli()- Date only
val formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy")val parsed = LocalDate.parse("12/04/2026", formatter)val millis = parsed .atStartOfDay(ZoneId.systemDefault()) .toInstant() .toEpochMilli()