The problem is in integer overflow. 24, 60, 60, 1000 and 1000 are all integer constants. As a result, the result of applying any mathematical operator to them will also be integer. However, 86400000000 does not fit into an integer; it will overflow several times to 500654080.

If you change the first 60 to 60L, the entire calculation will be using long as the result type, and you will have no problem.