Jump to content

Entry disappearing after a specific time


cordoprod

Recommended Posts

explaining something like this is quite complicated.... why cant you use mysql instead?

 

----

anyway im guessing you know how to find,edit and delete entries from your flat file, so you want to know how to compare a date to check how old it is?

 

first off, save a date_added field with a time(); unix timestamp. check this field like so:

 

if(time() >= ($db_date_added + 2592000)){
  // delete entry
}

 

this will delete the record after 30 days.

 

--------

also see http://www.php.net/date for more information on the php's date functionality

 

 

hope this helps,

Link to comment
Share on other sites

do you mean when you read it?

 

have a look at php.net/date and choose, i usually go for : date("jS F y");

 

if saving to a db you should ALWAYS use time(); as a unix timestamp, you can use date("jS F y",time()); to format timestamps.

hope this helps,

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.