[UPHPU] mysql date calculation bug

Jim Anderson jim.anderson at techiegroup.com
Tue Oct 16 14:38:18 MDT 2007


initial looks tells me that the following won't work either. run the 
following:

SELECT DATE_ADD('2007-02-28', INTERVAL 6 MONTH) + INTERVAL 49 DAY = 
CURDATE();
SELECT DATE_ADD('2007-03-01', INTERVAL 6 MONTH) + INTERVAL 45 DAY = 
CURDATE();

those 2 queries both return true. notice, though, that they are 1 
calendar day apart and 4 interval days apart. this is going to have the 
same basic effect as before. :(

i think the least development time is going to run a check to see if the 
email has been sent within 5 days and , if so, don't send it again. [5 
days chosen as the largest margin of duplication, that i can see, is 4 
days [february] but this would happen in any month begin/end cycle.]

i do like the brain storming though. feel free to keep up the ideas!

thnx,
-ja



Ben Reece wrote:
> Jim Anderson wrote:
>> A good suggestion. I thought of that as well, but seem to remember 
>> coming across similar issues. I've had about 15 things in my head 
>> throughout the day so I may be getting some of my issues/projects 
>> schmeared though. Do you think doing it that way would skip over 
>> anyone? I saw that as an unlikely, but possible, concern.
>>
>> i was thinking something like:
>>
>> WHERE DATE_ADD(start_date, INTERVAL 6 MONTH) + INTERVAL 45 DAY = 
>> CURDATE()
>>
>> but i haven't had the time to test it out.
>>
>> to fill out the scenario a bit fuller, the criteria is this:
>>
>> * 9 different emails. one for each of the following date scenarios.
>> * six months after sign-up minus 45 days
>> * six months after sign-up minus 30 days
>> * six months after sign-up minus 15 days
>> * six months after sign-up minus 5 days
>> * six months after sign-up [minus 0 days]
>> * six months after sign-up plus 15 days
>> * six months after sign-up plus 30 days
>> * six months after sign-up plus 45 days
>> * six months after sign-up plus 60 days
>>
>> That is the schedule that i have in place.
>>
>> -jim
> I don't see any problem with that statement -- seems like it would 
> work without any problems.  The only possible issue would be that the 
> emails might not be the exact number of days apart that you show, 
> since you're adding months, and the date can move a little bit because 
> of that.
> Ben


More information about the UPHPU mailing list