The following program produces incorrect output:
public class date
{
public static void main(String[] args)
{
Date d1 = new Date(1698526800000L);
Date d2 = new Date(1698530400000L);
Date d3 = new Date(1698534000000L);
Date d4 = new Date(1698537600000L);
System.out.println(d1);
System.out.println(d2);
System.out.println(d3);
System.out.println(d4);
}
}
result:
Sun Oct 29 00:00:00 IDT 2023
Sun Oct 29 01:00:00 IDT 2023
Sun Oct 29 01:00:00 IST 2023
Sun Oct 29 02:00:00 IST 2023
Why do d2 and d3 produce the same date although given different ms value?
EDIT:
i only wanted to know WHY this was happening, and i found out Daylight saving time was to blame on this one