Answer the question
In order to leave comments, you need to log in
How to check if a birthday is in a certain period?
There is a check-in date and a check-out date. Need to determine whether the client will have a birthday during their stay at our hotel? The problem is that the date of birth will not be 2022. That is, it is impossible to simply compare between the dates of settlement and eviction, for example, 03/16/1980 in both cases will be less.
The transaction card indicates the date of settlement and the date of eviction.
The date of birth is indicated in the contact card.
In the robot, at a certain stage of the transaction, it is necessary to determine whether the birthday will be during the period of residence.
Is it possible to use substr with a 'date' type variable?
As an option, I tried to subtract the date of birth from system:now using datediff with the '%y' parameter to calculate the difference in years, and then add it to the date of birth and compare with the dates of arrival and departure. But, in any case, after datediff the variable does not get the difference in years, but always gives 01/01/1970.
How to change the year of birth in the year of settlement?
Answer the question
In order to leave comments, you need to log in
03/16/1980 is a date of birth, not a birthday. Birthday in the sense in which you use this term in this case is 03/16/2022. You can already compare this date with the dates of settlement. Difficulties here are added by the option of arrival and departure in different years, but they are also easily resolved.
In other words, you take the year of arrival, substitute it into the date of birth and check that the resulting date falls within the range. Then repeat the same for the year of departure, if it differs from arrival. If at least somewhere fell into the range, then others will be in the hotel.
As an option, I tried to subtract the date of birth from system:now using datediff with the '%y' parameter to calculate the difference in years, and then add it to the date of birth and compare with the dates of arrival and departure.
Is it possible to use substr with a 'date' type variable?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question