note 53711 deleted from function.mktime by derick

From: Date: Sun, 24 Sep 2006 11:58:27 +0000
Subject: note 53711 deleted from function.mktime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-117508@lists.php.net to get a copy of this message
Note Submitter: phpprince at phpprince dot com ---- i was writing a mini auction script and tried to replicate ebay's 7 day listing. so if you post your auction today, it will end exactly 7 days later, exact up to the seconds. $today = date("Y-m-d H:i:s"); // get today's date $sep = explode(" ",$today); // split into day and time $day = $sep[0]; $time = $sep[1]; $timesep = explode(":",$time); // split time into hr, min, sec $hour = $timesep[0]; $min = $timesep[1]; $sec = $timesep[2]; $enddate = mktime($hour,$min,$sec, date("m"),date("d")+7,date("Y")); // add 7 to the day, the hour, minutes and second are grabbed from the current time using variables from the $timesep explode $enddate = date("Y-m-d H:i:s", $enddate); // the enddate echo $enddate; voila!

« previous php.notes (#117508) next »