Re: date math

From: Date: Mon, 22 May 2000 11:40:05 +0000
Subject: Re: date math
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-281@lists.php.net to get a copy of this message
> Why not just do > > date()-(60*60*24*14) > > which should give you 14 days ago. > > 60 seconds, 60 minutes, 24 hours, 14 days..... > That's nice but I've used this perticular select statement because you can select the specific items you want X ago. SELECT *, DATE_FORMAT(timestamp, INTERVAL X Y) ... So if you wanted the last month you can just do SELECT *, DATE_FORMAT(timestamp, INTERVAL 1 MONTH) ... (timestamp is ofcourse the desired timestamp columb) Hope you can do anything with this, Dido. > > I am writing a small little function to find all > > entries in a table and echo them that are 14 days > > prior to the current day. I have figured it out > > if the entry is in the same month. > > But a late entry in the previous month has me a > > bit confused. > > I am using date() to find the current day , and > > have a nifty timestamp in my table. > > > > Thanks > > Eric

« previous php.general (#281) next »