how to get current date and time in android studio
MainActivity.java
// get current date in 03-01-2020 format
String currentDate = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()).format(new Date());
// get current date in 03-Jan-2020 format
String currentDate2 = new SimpleDateFormat("dd-MMM-yyyy", Locale.getDefault()).format(new Date());
// get day name like Mon, Tue, Wed, etc.
String dayName = new SimpleDateFormat("E", Locale.getDefault()).format(new Date());
// get time in 12 hours
String getTime = new SimpleDateFormat("hh:mm:ss a", Locale.getDefault()).format(new Date());
// get time in 24 hours
String getTime2 = new SimpleDateFormat("HH:mm:ss", Locale.getDefault()).format(new Date());
// get both date and time
String currentDateTime = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.getDefault()).format(new Date());
Projects with Source Code + Video Tutorials
You can download our Java and Android Studio Projects with Source Code and Video Tutorials.

Online Quiz Application using Firebase and Admob

Simple Calculator App for Android

Login and Register using Firebase Realtime Database
If you have any Questions or Queries
You can mail us at info.learnoset@gmail.com
Follow us to learn Coding and get in touch with new Technologies.