21.01.2011, 23:15
Hello all,
I would like some help on the following matters.
For use in a hotel system, I will need to calculate dates. This will include things like calculating tomorrow's date, calculating which data is earlier etc.
I have managed to create a function which returns whether the chosen date is earlier than the present one. What I cannot manage though is solving the first problem. What I basically want to do is allow players to enter a number of nights to stay. After this the date of the 'checkout' day will be stored. So, if I for example on the 30th of January enter 4 nights, that would set the checkout date to the third of February. So I would need a function like 'CalculateDateXDaysFromNow(days)'. But how would I calculate such a thing? I have found an example in C++, that would be too complicated to write in PAWN though.. And it wasn't bugfree neither.
An other option would be to do it the other way around: The player would enter the checkout-date after which the server would calculate the nights to be billed. But this would probably involve similar calculations..?
Would anyone be willing to lend a hand?
Thank you in advance!
I would like some help on the following matters.
For use in a hotel system, I will need to calculate dates. This will include things like calculating tomorrow's date, calculating which data is earlier etc.
I have managed to create a function which returns whether the chosen date is earlier than the present one. What I cannot manage though is solving the first problem. What I basically want to do is allow players to enter a number of nights to stay. After this the date of the 'checkout' day will be stored. So, if I for example on the 30th of January enter 4 nights, that would set the checkout date to the third of February. So I would need a function like 'CalculateDateXDaysFromNow(days)'. But how would I calculate such a thing? I have found an example in C++, that would be too complicated to write in PAWN though.. And it wasn't bugfree neither.
An other option would be to do it the other way around: The player would enter the checkout-date after which the server would calculate the nights to be billed. But this would probably involve similar calculations..?
Would anyone be willing to lend a hand?
Thank you in advance!