note 69387 modified in function.date by bobby

From: Date: Thu, 07 Sep 2006 18:27:34 +0000
Subject: note 69387 modified in function.date by bobby
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116866@lists.php.net to get a copy of this message
***EDITOR NOTE: Referred to note has been removed. The calculation function of the number of days between 2 dates by zzzdobr at gmai dot com could be done much easier: <? function getdays($day1,$day2) { return round((strtotime($day2)-strtotime($day1))/(24*60*60),0); } $begin = date("Y/m/d"); // we set today as an example $end = "2006/11/27"; getdays($begin,$end); ?> So now all of you know how many days you have left to buy me a birthday present ;) --was-- oops, my previous post contained some errors. Here is the right one: The calculation function of the number of days between 2 dates by zzzdobr at gmai dot com could be done much easier: <? function getdays($day1,$day2) { return round((strtotime($day2)-strtotime($day1))/(24*60*60),0); } $begin = date("Y/m/d"); // we set today as an example $end = "2006/11/27"; getdays($begin,$end); ?> So now all of you know how many days you have left to buy me a birthday present ;) http://php.net/manual/en/function.date.php

« previous php.notes (#116866) next »