The problem with converting java.util.Date to org.joda.time.LocalDateTime

import org.joda.time.LocalDateTime;
import java.util.Date;

Everything is OK with this date or with the following versions:

  • new LocalDateTime(new Date(0,0,1,2,30)) - 1900-01-01T02: 30: 00.000
  • new LocalDateTime(new Date(111,4,24,19,51)) - 2011-05-24T19: 51: 00.000

But with the previous dates there is something incomprehensible:

  • new LocalDateTime(new Date(0,0,1,2,29,50)) - 1900-01-01T01: 59: 50.000
  • new LocalDateTime(new Date(0,0,1)) - 1899-12-31T23: 30: 00.000
  • new LocalDateTime(new Date(-50,0,1)) - 1849-12-31T23: 30: 20.000
  • new LocalDateTime(new Date(-116,6,4)) - 1784-07-03T23: 30: 20.000

Who knows what it is and how to prevent this problem?

+3
source share
1 answer

? , , , 2 1 1900 . , . . 3 , , , Java Calendar Joda Time , .

.

+3

All Articles