Jump to content

A quickie: Calculating dates from a date in the database?


djfox

Recommended Posts

I`m using this format of dates:

$entry_date = strftime("%B\ %e\,\ %Y %H:%M:%S", time());

 

And that time gets saved into the database (birth in ownedpets database):

 

$res = mysql_query("SELECT id, owner, pet_type, pet_name, birth, food, play, datetime FROM ownedpets WHERE id=$id");
$rows = mysql_fetch_row($res);
mysql_free_result($res);

 

So let`s say in this case, the database birth value ($rows[4]) is October 19 2007 20:00:00. What do I do to tell php to check to see if the current date (hours and all don`t matter) is 21 days after the $rows[4]?

 

Why I`m looking for this task:

For the pets system, if the pet is 21 days after it`s birth, it will be an adult. But if it is not 21 days after it`s birth, it will still be a baby.

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.