You are here: Re: looping until today « PHP Programming Language « IT news, forums, messages
Re: looping until today

Posted by Carl Vondrick on 04/01/06 10:38

To convert a string to a date, you can use strtotime() to make a timestamp.

So, for example:

echo date ('Y-m-d',strotime('8:30 PM'));

pauld wrote:

> I want to loop through dates, stopping at the current date
>
> I set the enddate like this
> $enddate=date('Y-m-d');
>
> which prints out as '2006-04-01'
>
> $l['cc_startdate'] comes from a DB with the column in date format
>
> but when i do
> for ($dl=$l['cc_startdate'];$dl < $enddate;$dl++)
> {
> print $dl;
> blah
>
> }
>
> it goes on until the day is 99 and then loops again.
> so how do I tell it that $enddate is in the same date format asthe
> start date

--
Carl Vondrick
Web-Engineer
www.carlsoft.net

 

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

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