PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Every Other Day Calculation
Every Other Day Calculation
Débuté par M. Beaven, 21 juil. 2003 19:52 - 2 réponses
Posté le 21 juillet 2003 - 19:52
Greetings all,
I have run into a bit of a pickle while writing a nursing function and wanted to see whether anyone had
coded this problem before. I need to be able to determine "Every other day" based on a beginning
date. The problem is that I cannot simply use IsOdd() or IsEven() due to certain months- i.e-
transitioning from a 31-day month, It would be necessary to move to even days from odd.
Herein is the problem. Does anyone have any ideas for how to determine, given a certain beginning
date, what dates represent "every other day" in relation to this beginning date?
Any help is appreciated.
Regards,
Marc
Posté le 21 juillet 2003 - 20:28
I believe I have a solution. For every other day, the difference between a given date and
the start date must be even. Therefore, if (IsEven(DateDifference(n,beginning date)))
then true, else false. I believe this will work for my needs in this situation.
Regards,
Marc
Greetings all,
I have run into a bit of a pickle while writing a nursing function and wanted to see whether anyone had coded this problem before. I need to be able to determine "Every other day" based on a beginning date. The problem is that I cannot simply use IsOdd() or IsEven() due to certain months- i.e- transitioning from a 31-day month, It would be necessary to move to even days from odd.
Herein is the problem. Does anyone have any ideas for how to determine, given a certain beginning date, what dates represent "every other day" in relation to this beginning date?
Any help is appreciated.
Regards,
Marc
Posté le 21 juillet 2003 - 20:41
Marc,

> I have run into a bit of a pickle while writing a nursing function and
wanted to see whether anyone had
coded this problem before. I need to be able to determine "Every other

day" based on a beginning
> date. The problem is that I cannot simply use IsOdd() or IsEven() due to
certain months- i.e-
transitioning from a 31-day month, It would be necessary to move to even

days from odd.

I (not yet) use Windev, but this should be simple as:

- convert both dates to long values
- run the substraction (result=actual-beginning)
- modulus divide the result by 2
- if 1 -> every other day

HTH
Mario