I need to compare two GregorianCalendar objects within an android application. I tried:
myCalendar.compareTo(otherCalendar)
myCalendar.getTimeInMillis() > otherCalendar.getTimeMillis()
In the emulator, running under ubuntu 64bit, both works fine. I tried then on a samsung galaxy s2 device with no luck. Comparison on real device is inverted, the bigger results smaller and viceversa. Printing the value on both systems with:
Long.toString(myCalendar.getTimeMillis())
I found out that a value of 1359716008000 in the emulator (I think this is the correct one) corresponds to -636369904720 in the actual device.
Any help would be really appreciated!
just for posterity, the problem was the GregorianCalendar value itself, I assigned the value with
It just needed a
as said here, the default locale of emulator (maybe US) was not the same of device (italian) so I think it was misparsing the day of the week in letters (“EEE”)