Re: Counting back 90 days...
| From: | Paul Chvostek | Date: | Mon, 05 Jan 2004 14:26:16 +0000 |
| Subject: | Re: Counting back 90 days... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173751@lists.php.net to get a copy of this message | ||
Richard Davey <rich@launchcode.co.uk> 05/01/2004 11:45:
>
> Based on the current time:
> $previous_90_days_timestamp = strtotime ("-90 day");
> All in one:
> $previous_90_days_date = date("Y-m-d", strtotime("-90 day"));
On Mon, Jan 05, 2004 at 11:55:36AM +0000, Tristan.Pretty@risk.sungard.com wrote:
>
> My word...
> 6 odd lines, to one...
Beware timestamps, though. They usually won't work for dates before
1970 or after 2038. If you suspect you'll need to use dates outside
that period (for example, show the 90 days of <whatever> as of some date
in 1969), your results may be unpredictable.
For example, strftime("%+",0) returns "Wed Dec 31 19:00:00 EST 1969" in
my timezone, and strftime("%+",-1) returns a blank. Yet, doing a
strtotime("1969-12-31 23:59:59 GMT") will get you a -1, and the date()
function appears to support negative timestamps ... which means you
can't skimp on your testing if you decide to go this route. ;-)
--
Paul Chvostek <paul@it.ca>
it.canada http://www.it.ca/
Free PHP web hosting! http://www.it.ca/web/