On Sun, 29 Oct 2006 23:04:27 -0600, Richard Lynch wrote:
> On Sun, October 29, 2006 2:06 am, Beauford wrote:
>> LOL, I don't know either. The format is - 01/01/2006. When I first did
>> it I
>> used 7, which should be right, but I ended up getting /2002 /2003,
>> etc. So I
>> went to 8 and all was well. Beats me.....
> 
> Dollars to donuts says your 'date' (which is really a string) has some
> leading spaces which is messing up your count...
> 
> Of course, after you fix the import process to have an actual DATE in
> your DB, this will be a non-issue...
> 
> Short-term, you should probably at least trim() the data so that your
> offset of 8 is the number you would expect...

Or, you use RIGHT(date, 4) as I believe MySQL always automatically removes
trailing spaces in VARCHAR columns. It will save you the use of one
additional function and RIGHT() may even be faster than SUBSTRING()
because it doesn't need to go through the entire string. But that's just
guessing and I think you probably won't even notice this in microseconds :)

Ivo

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to