djfox Posted October 21, 2007 Share Posted October 21, 2007 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 https://forums.phpfreaks.com/topic/74159-a-quickie-calculating-dates-from-a-date-in-the-database/ Share on other sites More sharing options...
Wes1890 Posted October 21, 2007 Share Posted October 21, 2007 Change to: $entry_date = time(); Then, read this on how to decode it into specific dates: http://us2.php.net/manual/en/function.date.php Link to comment https://forums.phpfreaks.com/topic/74159-a-quickie-calculating-dates-from-a-date-in-the-database/#findComment-374509 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.