Re: [PHP] Dates and Mysql

2008-12-10 Thread Micah Gersten

VamVan wrote:
> Hello Gang,
>
> I have a Mysql table which has timestamp for the date the record was
> created.
>
> I was wondering how is it possible for me to query the table to retrieve all
> the records that are one week less than the time stamp?
>
> Thanks,
> V
>
>   
I'm assuming you meant get records one week less than the current system
timestamp.

date('Y-m-d G:i:s', strtotime('1 week ago'));

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com




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



Re: [PHP] Dates and Mysql

2008-12-10 Thread Chris

VamVan wrote:

Hello Gang,

I have a Mysql table which has timestamp for the date the record was
created.

I was wondering how is it possible for me to query the table to retrieve all
the records that are one week less than the time stamp?


http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html


--
Postgresql & php tutorials
http://www.designmagick.com/


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



Re: [PHP] Dates and Mysql

2008-12-10 Thread Kevin Waterson
This one time, at band camp, VamVan <[EMAIL PROTECTED]> wrote:

> I was wondering how is it possible for me to query the table to retrieve all
> the records that are one week less than the time stamp?


SELECT DATE_SUB(date_time_column, INTERVAL 1 WEEK) FROM your_table;
http://www.phpro.org/tutorials/Introduction-to-PHP-and-MySQL.html#45

Kevin

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