How to print the current time and date in the Android app

Asked 2 years ago, Updated 2 years ago, 19 views

I want to print out the current time and date on the Android app, what should I do?

android

2022-09-21 15:40

1 Answers

It's not that difficult. Assuming output to TextView

String currentDateTimeString = DateFormat.getDateTimeInstance().format(new Date());

//print current time and date to text view
textView.setText(currentDateTimeString);

You can do it like this.


2022-09-21 15:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.