You are here: Re: How to get the days between two given dates (no sql stuff) « PHP Programming Language « IT news, forums, messages
Re: How to get the days between two given dates (no sql stuff)

Posted by Marcin Dobrucki on 08/23/05 13:27

JAPIO wrote:
> I have two variables which look like:
> $begin = "23-08-05"
> $end = "26-08-05"
>
> Now i want also to know the dates between them.
> 24-08-05
> 25-08-05
>
> How can i do this? Any help would be appreciated.

(hope this is not some course homework...)

list ($day, $month, $year) = split('-', $date);
$t = mktime(0,0,0,$day,$month,$year+2000)

So now you have start/end. Then:

while ($start < $end) {
do_whatever();
$start += 86400;
}

And you can use date() to convert the timestamp back to
human-readable format.

/Marcin

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация