About midway down the page...:
http://www.mysql.com/doc/S/t/String_functions.html
SUBSTRING(str,pos)
SUBSTRING(str FROM pos)
Returns a substring from string str starting at position pos:
mysql> select SUBSTRING('Quadratically',5);
-> 'ratically'
mysql> select SUBSTRING('foobarbar' FROM 4);
-> 'barbar'
This function is multi-byte safe.
C:~
-----Original Message-----
From: Chuck "PUP" Payne [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 5:10 AM
To: Mike; [EMAIL PROTECTED]
Subject: Re: Another question of Date.
Mike and the mysql list,
This is the SQL statement I am using now;
SELECT DATE_FORMAT(DOB, '%M %D, %Y') as DOB, Fname, Lname, Email FROM
emply_info WHERE (TO_DAYS(DOB) - TO_DAYS(NOW())) <=7 AND (TO_DAYS(D\
OB) >= TO_DAYS(NOW())) and Tdate is NULL and DOB is not null ORDER BY DOB,
Lname
But it only works because I had to change the year to 2002, I don't want to
change 2002. That was my question I want to read the field but only the
month and the date. NOT FORMAT. I also like to read that field but only the
year and take this year to get how old a person is. I hope that clears it
up.
Chuck
on 4/11/02 8:02 AM, Mike at [EMAIL PROTECTED] wrote:
> Sorry, Do you mean to use the date in a WHERE clause? I've use php's date
> function to supply a date for a WHERE clause in a sql statement.
>
> Mike
> ----- Original Message -----
> From: "Chuck "PUP" Payne" <[EMAIL PROTECTED]>
> To: "Mike" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Thursday, April 11, 2002 7:53 AM
> Subject: Re: Another question of Date.
>
>
>> Thanks but I want to be able able to use this in SQL statement not format
>> the output.
>>
>> Chuck
>>
>> on 4/11/02 7:46 AM, Mike at [EMAIL PROTECTED] wrote:
>>
>>> http://www.mysql.com/doc/D/a/Date_and_time_functions.html
>>>
>>> mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
>>> -> 'Saturday October 1997'
>>> mysql> select DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s');
>>> -> '22:23:00'
>>> mysql> select DATE_FORMAT('1997-10-04 22:23:00',
>>> '%D %y %a %d %m %b %j');
>>> -> '4th 97 Sat 04 10 Oct 277'
>>> mysql> select DATE_FORMAT('1997-10-04 22:23:00',
>>> '%H %k %I %r %T %S %w');
>>> -> '22 22 10 10:23:00 PM 22:23:00 00 6'
>>> mysql> select DATE_FORMAT('1999-01-01', '%X %V');
>>> -> '1998 52'
>>>
>>>
>>> Mike
>>> ----- Original Message -----
>>> From: "Chuck "PUP" Payne" <[EMAIL PROTECTED]>
>>> To: <[EMAIL PROTECTED]>
>>> Sent: Thursday, April 11, 2002 7:42 AM
>>> Subject: Another question of Date.
>>>
>>>
>>>> Hi,
>>>>
>>>> I got a small problem I like to be able to read a DATE but I don't want
> to
>>>> read the Year. I only want to read the month and the date. For example,
> I
>>>> like to read the a Birthday Field to see who Bithday is today. Also
> like
>>> to
>>>> be later be able to read that same field but this time the year so that
> I
>>>> can see how old a person is. Is there any example on the net of this?
>>>>
>>>> Chuck
>>>>
>>>> Sql and MySql
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> Before posting, please check:
>>>> http://www.mysql.com/manual.php (the manual)
>>>> http://lists.mysql.com/ (the list archive)
>>>>
>>>> To request this thread, e-mail <[EMAIL PROTECTED]>
>>>> To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
>>>> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>>>
>>>
>>> ---
>>> Outgoing mail is certified Virus Free.
>>> Checked by AVG anti-virus system (http://www.grisoft.com).
>>> Version: 6.0.330 / Virus Database: 184 - Release Date: 2/28/02
>>>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.330 / Virus Database: 184 - Release Date: 2/28/02
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php