Question Detail
How do I Display the current Time and Date in an Android application ?
I want to add Current dateTime in my database Table while running SQLite Query to Save Data in Table.
How do I display the current date and time in an Android application?
Thread Reply
Hemant Sharma
- 3 years ago
You need to pass todayDay()
in your SQL Query where you want current DateTime
String todayDay() { Calendar calendar = Calendar.getInstance(); Date today = calendar.getTime(); calendar.add(Calendar.DAY_OF_YEAR, 1); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh-mm-ss");; return dateFormat.format(today); }
Goal Ploy - Money Management App