I have an Android application which is dealing with dates. I am using Calendar, because I need the day, month and year only.
I am using Calendar.getInstance()
to get the current date, then I am using cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
to set the date to Sunday.
I ran this code today, 15th Feb (Saturday).
When I ran this on the Eclipse emulator, the date rolled back to the previous Sunday, that is 9th Feb.
When I ran it on my phone, the date rolled ahead to the next Sunday, that is 16th Feb.
Why is this happening? Is it because of different versions of the OS?
Also, I need it to ROLLBACK only. How can I ensure this?