How to show the current time and date in TextView ?
1 answer
The old way:
SimpleDateFormat format = new SimpleDateFormat("dd.MM.yyyy"); textview.setText(format.format(new Date())); In a new way:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy"); textview.setText(LocalDate.now().format(formatter)); - In the version of android studio 3.3.3, the "For the old" version worked perfectly - privetsh
|