Consider the following:
import java.time.*;
var today = Instant.now();
var futureDay1 = today.atZone(ZoneId.systemDefault()).plusDays(1428826726);
var futureDay2 = today.atZone(ZoneOffset.UTC).plusDays(1428826726).withZoneSameInstant(ZoneId.systemDefault());
being ZoneId.systemDefault()
the Europe/Rome timezone.
In the end, the following stands:
futureDay1 ==> +3914019-03-19T16:42:44.377406+01:00[Europe/Rome]
futureDay2 ==> +3914019-03-19T15:42:44.377406+01:00[Europe/Rome]
so, futureDay2 is one hour behind. I can’t explain myself why. Current time (4 PM) is not at risk of DST, so why does it happen?
Of course, it does not happen for any number of days added.
And it’s not just a problem of representation: if you convert both to milliseconds from Epoch, the two values are actually two distinct instants, so different long values.
1