Page 1 of 1
getting date difference
Posted: Tue Feb 08, 2005 3:16 am
by itsmani1
hello people...
i m using php/mysql and i need help in qry:
in my DB the table has a date field with data type date and time
now i want to select those rows that are exectly one month old
any help plz.
Code: Select all
$qry "select date from table where date < one_month ";
Posted: Tue Feb 08, 2005 3:23 am
by feyd
Posted: Tue Feb 08, 2005 3:44 am
by itsmani1
oki thanks yaar hope it will work
Posted: Tue Feb 08, 2005 3:44 am
by patrikG
Code: Select all
SELECT field FROM table WHERE CURDATE()<=date_end AND CURDATE()>=date_start
Good idea to read the manual, too.
Posted: Tue Feb 08, 2005 5:17 am
by itsmani1
SELECT * FROM tree
WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) > 8/18/2004
can you tell me :
DATE_SUB(CURDATE(), => what is this
INTERVAL 30 DAY) => what is this
Regards
Posted: Tue Feb 08, 2005 7:48 am
by feyd
Subtract from CURDATE() (current date and time) ... 30 days.
Posted: Tue Feb 08, 2005 9:57 am
by anjanesh
Just check which functions you are using. Most of the current functions are available in MySQL 4.1 and not 4.0. Some servers have still not upgraded.
http://dev.mysql.com/doc/mysql/en/date- ... tions.html