|
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]
|