Dates between two date

Hi

How to get list of dates between two dates?
in this format (2012-5-21)

That is a very popular question. Google that and it turns up numerous results. This one is at the top of the list:

http://biostall.com/get-a-list-of-dates-between-two-dates-with-php

EDIT: found an error testing the script, the example shown should be something like this:

<?php
    // Specify the start date. This date can be any English textual format  
    $date_from = "2012-4-21";  
    $date_from = strtotime($date_from); // Convert date to a UNIX timestamp  
      
    // Specify the end date. This date can be any English textual format  
    $date_to = "2012-5-21";  
    $date_to = strtotime($date_to); // Convert date to a UNIX timestamp  
      
    // Loop from the start date to end date and output all dates inbetween  
    for ($i=$date_from; $i<=$date_to; $i+=86400)
    {
        echo date("Y-m-d", $i).'<br />';  
    }  
?>

Can’t take things from the internet for granted :frowning: