[PHP] Re: date field

2005-08-11 Thread John Taylor-Johnston

Thanks Ben!
John

Ben Ramsey wrote:


In PHP, you could do something like:

$updated  = strtotime($db_result['updated']);
$one_year_ago = strtotime('-1 year');

if ($updated  $one_year_ago) {
// updated date is older than a year ago
}


John Taylor-Johnston wrote:

I have a field 'updated' How can I tell if the date is older than 1 
year ago (or should I think of 365 days)?


`updated` date NOT NULL default '1999-12-12'

I've looked at: http://ca3.php.net/manual/en/function.getdate.php

Thanks,
John






--
John Taylor-Johnston
-
If it's not Open Source, it's Murphy's Law.

 ' ' 'Collège de Sherbrooke:
ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/
   - 819-569-2064

 °v°   Bibliography of Comparative Studies in Canadian, Québec and Foreign 
Literatures
/(_)\  Université de Sherbrooke
 ^ ^   http://compcanlit.ca/ T: 819.569.2064

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



[PHP] Re: date field

2005-08-10 Thread Ben Ramsey

In PHP, you could do something like:

$updated  = strtotime($db_result['updated']);
$one_year_ago = strtotime('-1 year');

if ($updated  $one_year_ago) {
// updated date is older than a year ago
}


John Taylor-Johnston wrote:
I have a field 'updated' How can I tell if the date is older than 1 year 
ago (or should I think of 365 days)?


`updated` date NOT NULL default '1999-12-12'

I've looked at: http://ca3.php.net/manual/en/function.getdate.php

Thanks,
John



--
Ben Ramsey
http://benramsey.com/

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