[UPHPU] mysql date calculation bug

Jim Anderson jim.anderson at techiegroup.com
Tue Oct 16 18:23:03 MDT 2007


Ben Reece wrote:
> True -- though the closest you'd have is 2 days when doing from +5 
> days to 0 days.

hmmm. not sure about this. not doubting you, just haven't thought on it 
thoroughly enough to have an opinion on the assertion. :) i do know that 
my instinct was saying that the problem was the same, just reversed. :(

in all, i think i have to bite the bullet and look at individual client 
histories. :( not my preferred method but it does seem to be the most 
robust while still solving the duplicate issue.

still, interested in any other thoughts that might get me there more 
efficiently. :) :)

thnx again,
-jim


>
> Jim Anderson wrote:
>> 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
>>
>> _______________________________________________
>>
>> UPHPU mailing list
>> UPHPU at uphpu.org
>> http://uphpu.org/mailman/listinfo/uphpu
>> IRC: #uphpu on irc.freenode.net
>>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net


More information about the UPHPU mailing list