I will try the suggestion from tuxdiuno. I should put that code inplace of the mill?
Now you have this:
displayNumber(millis()/1000);
I think you should have this instead:
displayNumber(counter);
Of course you have to declare counter and increment its value when you detect a change in the analogRead() value.
It's also very important that you understand how to get rid of delay()s in the code. Hint: blink without delay example.