I'm porting my code from Timestamp
to LocalDateTime
, when I made a tests to get a milliseconds from LocalDateTime
I saw a difference result from get it using Calendar
and Date
.
This is my "test":
System.out.println(LocalDateTime.of(2016,5,19,14,8,0).toInstant(ZoneOffset.UTC).toEpochMilli());
System.out.println(Timestamp.valueOf(LocalDateTime.of(2016,5,19,14,8,0)).getTime());
Calendar c = Calendar.getInstance(TimeZone.getTimeZone(ZoneId.of("UTC")));
c.set(2016,5,19,14,8,0);
System.out.println(c.getTime().getTime());
I don't understand why the difference between those.