Ciao a tutti ...
dovendo calcolare la distanza in giorni, mesi e anni tra due date ho trovato on line questo script che va bene, l'unico problema è che vuole la data formattata "in stile americano".
Come posso fare per modificare lo script in modo che prenda la data in questo modo "gg/mm/aaaa" ?


codice:
class DateDiff 
{ 	 	
     private $m_pDates; 	
     private $m_aConversions;
   	
     public function __construct($iStartDate, $iEndDate)
     {
          $this->m_aConversions = array
          (
          'Seconds' => 0,
          'Minutes' => 60,
          'Hours' => 3600,
          'Days' => 86400,
          'Weeks' => 604800,
          'Months' => 2620800,
          'Year' => 31449600
    );

    $this->m_pDates->start = $iStartDate;
    $this->m_pDates->end = $iEndDate;
    }
    public function __call($szCall, $aArgs)
   {

      if(!preg_match('~^in(.+)~', $szCall, $aMatches))
      {
        throw new Exception('Invalid conversion format supplied.');
      }
      $szCall = $aMatches[1];
      if (!in_array($szCall, $this->m_aConversions))
      {
      throw new Exception('Specified conversion is not available.');
      }
      if($this->m_aConversions[$szCall] == 0)
      {
      return strtotime($this->m_pDates->end) - strtotime($this->m_pDates->start);
      }
      return(strtotime($this->m_pDates->end) - strtotime($this->m_pDates->start)) / $this->m_aConversions[$szCall];
   }
}
e poi visualizzo i risultati in questo modo:

codice:
$pDate = new DateDiff('01/04/2011', '01/05/2011');
printf('Difference: %d days
', $pDate->inDays());
printf('Difference: %d weeks
', $pDate->inWeeks());
printf('Difference: %d months
', $pDate->inMonths());
printf('Difference: %d year
', $pDate->inYear());
Con questo esempio dovreste ricevere come risultato:

Difference: 1 days
Difference: 0 weeks
Difference: 0 months
Difference: 0 year

Grazie a tutti per l'aiuto