Re: getting a date 25 years back

From: Date: Tue, 14 Dec 2004 21:52:28 +0000
Subject: Re: getting a date 25 years back
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-204344@lists.php.net to get a copy of this message
You should do date arithmetic using the Unix date format (number of seconds since 1970). I think these string format dates are not appropriate. Mario Merlin wrote:
Hi there, I am trying to create a date which is 25 years back from today. The purpose of this is to be able to query a mysql database "date" field for columns smaller than this date. I tried this: $years = 25; $start_from = date("Y-m-d",strtotime("- ".$years." year")); Somehow it always ads the years instead of subtracting. Has anybody an idea on how to do that? Thank you in advance for any help, Merlin


« previous php.general (#204344) next »