I'm using the new Date()
function in order to get the current date. However, on the 29th of December, 2019 (29/12/2019), the function begins to display the 29th of December, 2020 (29/12/2020), incorrectly moving the year forward 3 days early.
It then reverts back to the correct year on the 1st of January (01/01/2020), correctly displaying the correct day, month and year.
I have absolutely no idea what is causing this, or why this happens.
Has anyone experienced this before and knows why? Or knows how to fix it?
My code for it is listed below. It's a pretty simple flow of events, but as mentioned above, as soon as the date reaches the 29th of December, the year in the TextView suddenly changes to 2020 instead of 2019. This happens in future years as well (2020 to 2021 etc.)
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/YYYY");
String currentDate = sdf.format(new Date());
startDateTextView.setText(currentDate);
Any help will be greatly appreciated :)