date display

Hello Guys,

I’m trying to display dates in while loop, and echoing them out only as dates “d”, but not full date format “Y-m-d”.
Unfortunately it works correctly only with full date format “Y-m-d”. As soon as I try different formats, loop goes to infinity…

Any ideas how to echo only the date without month and year in this code?

[php]
// Set timezone
date_default_timezone_set(‘UTC’);
// Start date
$date = date(‘Y-m-d’);
// End date
$end_date = date(‘Y-m-d’, strtotime(’+3 days’));
echo ‘

’;
while (strtotime($date) <= strtotime($end_date)) {
echo ‘”;
$date = date (‘Y-m-d’, strtotime(’+1 day’, strtotime($date)));
}
echo “
’;
echo “$date\n”;
echo “
”;
[/php]

Thanks,
Raivis

solved!

changed the echo line to:
[php] echo date(‘d’,strtotime($date))."\n"; [/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service