Millis () funtion fails to perform for extended period of time
In C++, the multiplication operator is “left-associative”. This means
that the expression

12*60*60*1000UL


is interpreted as

((12*60)*60)*1000UL


The left factor, namely (12*60)*60, is computed using the int data
type, but the result overflows that format, resulting in the problem you
see.

The simple solution is to make one of the factors of the first product
be an unsigned long. For example

1000UL*60*60*12


Then, 1000UL*60 is computed with the unsigned long data type. Since
the result is itself an unsigned long, the next multiplication is also
done as unsigned long, and likewise for the last one.

If you find this technique somewhat obscure, you can also add the UL
suffix to every single factor. This would avoid implicit conversions by
the compiler, making all the types explicit.