I'm inserting a date to a database H2 in a Android application and when the date is bigger than January 19, 2038 (Unix year 2038 bug) the date that is saved to the database changes according the timezone of the android device.
Example: Date 2050-12-31
- Timezone +2:00 El Cairo saves 2050-12-29 (ERROR)
- Timezone +2:00 Amsterdam saves 2050-12-30 (ERROR)
- Timezone +2:00 Brussels saves 2050-12-31 (OK)
- Timezone of Japan saves 2050-12-31 (OK)
- Timezone of China saves 2050-12-31 (OK)
- Timezone of Azores saves 2050-12-31 (OK)
I suppose that the Linux kernel that uses android has the 2038 year bug but I don't understand the reason of in some cases it works ok and in others don't.
Any solution to this problem? Is safe use java.util.Date
in Android?