Re: Reg date manipulation
| From: | David Otton | Date: | Thu, 24 Apr 2003 08:40:29 +0000 |
| Subject: | Re: Reg date manipulation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145128@lists.php.net to get a copy of this message | ||
On Thu, 24 Apr 2003 11:27:49 +0530, you wrote:
>We are facing a very simple problem and don't know how to solve it.
>We have a web page which accepts a starting date and an ending date, on receiving these dates we
>have to print all dates starting from the start date to the end date.
>For example if users input is 01/01/2003 to 04/01/2003
>we have to print 01/01/2003, 02/01/2003, 03/01/2003, 04/01/2003
>
>we have tried to use dateadd but when we try to print the value using
>strfdate function - we are always getting the value 01/01/1970 irrespective of the input value.
"dateadd"? *shrug*.
$first = mktime(0, 0, 0, 1, 1, 2003);
$last = mktime(0, 0, 0, 1, 4, 2003); /* whoever wrote mktime() was an
idiot */
while ($first <= $last) {
echo date('r', $first) . '<br>';
$first = $first + 60*60*24;
}