variable value retention

A variable is delared globally as unsigned long.

This variable is calculated in a function A once every even day. In another function B this same variable is used every day; however currently when this variable is used in function B on a uneven day (when not calculated in function A) its value has reverted to 0.

How can a variable keep its calculated value (in this case every even day) and be used every day without having to be recalculated first?

How about you post your code that displays this behaviour ?
How are you doing the timing ?
Is there a chance that the Arduino is being reset between uses of the variable ?

UKHeliBob:
How about you post your code that displays this behaviour ?
How are you doing the timing ?
Is there a chance that the Arduino is being reset between uses of the variable ?

The code contains about 714 lines so I thought it might be a better idea to post this as a general question?
Timing is done with a DS3231, that works well to keep track of days and times.
Reset of controller: no, it does not get a reset between variable uses (I can tell from Thingspeak value uploads).

From what I can deduct from your comment its value should be retained even as being declared a global variable?

The code contains about 714 lines so I thought it might be a better idea to post this as a general question?

I appreciate what you say but without seeing the code all that we can do is suggest possible causes, but it is a guessing game.

A variable of any kind should retain its value unless it is explicitly changed by the program or is changed by the program as a side effect of doing something else that is apparently unrelated. What could that be ? Well, classic causes of such a problem would be 2 different variables with the same name but different scopes or misuse of an array subscript causing memory corruption.

Can you see how it might be helpful to see the code ?

Please, pass the code. If you can't post it you can pass the file