0

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?

Vedavyas Bhat
  • 2,068
  • 1
  • 21
  • 31

1 Answers1

0

Looks like this was answered a few years ago. It is not because of different Android versions since this has been in existence since the beginning.

Community
  • 1
  • 1
Dakota Brown
  • 730
  • 7
  • 20