Jump to content

[ resolved ] simple question..


acidglitter

Recommended Posts

So I have this code that I got off from a website...

[code]$tomorrow = mktime(0,0,0,date("m"),date("d")-3,date("Y"));
echo "3 days ago.. ".date("F d, Y", $tomorrow);[/code]

I just changed it so it shows a date from 3 days ago.. So.. I'm wondering, how could I show all the rows in a table with a date from 3 or more days ago?
Link to comment
Share on other sites

Something like this maybe?  It assumes the field 'date' is a DATETIME.  If it's a unix timestamp, then remove the FROM_UNIXTIME function.  Just run the query as you would any other.  It's not tested but it should work.

[code]
$three_days_ago = mktime(0,0,0,date("m"),date("d")-3,date("Y"));

$sql = "SELECT * FROM table WHERE date <= FROM_UNIXTIME($three_days_ago)";
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.