I am fairly new to java and I am creating a fitness application.
Context: Database should add a new date entry every day the app is opened
Problem: Opened the app yesterday and it successfully added the date: 31.1.21. However opened it today and database has added 32.2.21 when it should be 1.2.21. Logs indicate that it must be an error with the code...
String timeStamp = new SimpleDateFormat("YYYY-MM-DD").format(Calendar.getInstance().getTime());
timeStamp = timeStamp + " 00:00:00.000";
android.util.Log.d(TAG, "Date/Time: " + timeStamp);
The code above is what is causing this issue, I am not familiar with Calendar and kindly ask if anyone knows what the issue could be. Many thanks.