Fix: Number of day calculation. Add PHPUnit case.

This commit is contained in:
Laurent Destailleur 2014-03-05 20:52:27 +01:00
parent dd3169e1ed
commit 774017672f
12 changed files with 134 additions and 102 deletions

View File

@ -382,13 +382,15 @@ interface Database
); );
/** /**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 * 19700101020000 -> 3600 with TZ+1 and gmt=0
* * 19700101020000 -> 7200 whaterver is TZ if gmt=1
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) *
* @return date Date TMS * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
*/ * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
function jdate($string); * @return date Date TMS
*/
function jdate($string, $gm=false);
/** /**
* Encrypt sensitive data in database * Encrypt sensitive data in database

View File

@ -553,20 +553,22 @@ class DoliDBMssql extends DoliDB
return dol_print_date($param,"%Y-%m-%d %H:%M:%S"); return dol_print_date($param,"%Y-%m-%d %H:%M:%S");
} }
/** /**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 * 19700101020000 -> 3600 with TZ+1 and gmt=0
* * 19700101020000 -> 7200 whaterver is TZ if gmt=1
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) *
* @return date Date TMS * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
*/ * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
function jdate($string) * @return date Date TMS
{ */
$string=preg_replace('/([^0-9])/i','',$string); function jdate($string, $gm=false)
$tmp=$string.'000000'; {
$date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4)); $string=preg_replace('/([^0-9])/i','',$string);
return $date; $tmp=$string.'000000';
} $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm);
return $date;
}
/** /**
* Format a SQL IF * Format a SQL IF

View File

@ -531,20 +531,22 @@ class DoliDBMysql extends DoliDB
return dol_print_date($param,"%Y%m%d%H%M%S"); return dol_print_date($param,"%Y%m%d%H%M%S");
} }
/** /**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 * 19700101020000 -> 3600 with TZ+1 and gmt=0
* * 19700101020000 -> 7200 whaterver is TZ if gmt=1
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) *
* @return date Date TMS * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
*/ * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
function jdate($string) * @return date Date TMS
{ */
$string=preg_replace('/([^0-9])/i','',$string); function jdate($string, $gm=false)
$tmp=$string.'000000'; {
$date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4)); $string=preg_replace('/([^0-9])/i','',$string);
return $date; $tmp=$string.'000000';
} $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm);
return $date;
}
/** /**
* Format a SQL IF * Format a SQL IF

View File

@ -542,17 +542,19 @@ class DoliDBMysqli extends DoliDB
} }
/** /**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 * 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
* *
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return date Date TMS
*/ */
function jdate($string) function jdate($string, $gm=false)
{ {
$string=preg_replace('/([^0-9])/i','',$string); $string=preg_replace('/([^0-9])/i','',$string);
$tmp=$string.'000000'; $tmp=$string.'000000';
$date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4)); $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm);
return $date; return $date;
} }

View File

@ -752,20 +752,22 @@ class DoliDBPgsql extends DoliDB
return dol_print_date($param,"%Y-%m-%d %H:%M:%S"); return dol_print_date($param,"%Y-%m-%d %H:%M:%S");
} }
/** /**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 * 19700101020000 -> 3600 with TZ+1 and gmt=0
* * 19700101020000 -> 7200 whaterver is TZ if gmt=1
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) *
* @return date Date TMS * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
*/ * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
function jdate($string) * @return date Date TMS
{ */
$string=preg_replace('/([^0-9])/i','',$string); function jdate($string, $gm=false)
$tmp=$string.'000000'; {
$date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4)); $string=preg_replace('/([^0-9])/i','',$string);
return $date; $tmp=$string.'000000';
} $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm);
return $date;
}
/** /**
* Format a SQL IF * Format a SQL IF

View File

@ -675,20 +675,23 @@ class DoliDBSqlite extends DoliDB
} }
/** /**
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true)
* 19700101020000 -> 3600 with TZ+1 * 19700101020000 -> 3600 with TZ+1 and gmt=0
* 19700101020000 -> 7200 whaterver is TZ if gmt=1
* *
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
* @return date Date TMS * @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
* @return date Date TMS
*/ */
function jdate($string) function jdate($string, $gmt=false)
{ {
$string=preg_replace('/([^0-9])/i','',$string); $string=preg_replace('/([^0-9])/i','',$string);
$tmp=$string.'000000'; $tmp=$string.'000000';
$date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4)); $date=dol_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),$gm);
return $date; return $date;
} }
/** /**
* Format a SQL IF * Format a SQL IF
* *

View File

@ -716,11 +716,11 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
} }
/** /**
* Fonction retournant le nombre de jour entre deux dates * Function to return number of days between two dates (date must be UTC date !)
* Example: 2012-01-01 2012-01-02 => 1 if lastday=0, 2 if lastday=1 * Example: 2012-01-01 2012-01-02 => 1 if lastday=0, 2 if lastday=1
* *
* @param timestamp $timestampStart Timestamp de debut * @param timestamp $timestampStart Timestamp start UTC
* @param timestamp $timestampEnd Timestamp de fin * @param timestamp $timestampEnd Timestamp end UTC
* @param int $lastday Last day is included, 0: non, 1:oui * @param int $lastday Last day is included, 0: non, 1:oui
* @return int Number of days * @return int Number of days
*/ */
@ -745,9 +745,9 @@ function num_between_day($timestampStart, $timestampEnd, $lastday=0)
/** /**
* Function to return number of working days (and text of units) between two dates (working days) * Function to return number of working days (and text of units) between two dates (working days)
* *
* @param timestamp $timestampStart Timestamp for start date * @param timestamp $timestampStart Timestamp for start date (date must be UTC to avoid calculation errors)
* @param timestamp $timestampEnd Timestamp for end date * @param timestamp $timestampEnd Timestamp for end date (date must be UTC to avoid calculation errors)
* @param int $inhour 0: return number of days, 1: return number of hours (72h max) * @param int $inhour 0: return number of days, 1: return number of hours
* @param int $lastday We include last day, 0: no, 1:yes * @param int $lastday We include last day, 0: no, 1:yes
* @param int $halfday Tag to define half day when holiday start and end * @param int $halfday Tag to define half day when holiday start and end
* @return int Number of days or hours * @return int Number of days or hours

View File

@ -44,8 +44,10 @@ class Holiday extends CommonObject
var $fk_user; var $fk_user;
var $date_create=''; var $date_create='';
var $description; var $description;
var $date_debut=''; var $date_debut=''; // Date start in PHP server TZ
var $date_fin=''; var $date_fin=''; // Date end in PHP server TZ
var $date_debut_gmt=''; // Date start in GMT
var $date_fin_gmt=''; // Date end in GMT
var $halfday=''; var $halfday='';
var $statut=''; // 1=draft, 2=validated, 3=approved var $statut=''; // 1=draft, 2=validated, 3=approved
var $fk_validator; var $fk_validator;
@ -214,6 +216,8 @@ class Holiday extends CommonObject
$this->description = $obj->description; $this->description = $obj->description;
$this->date_debut = $this->db->jdate($obj->date_debut); $this->date_debut = $this->db->jdate($obj->date_debut);
$this->date_fin = $this->db->jdate($obj->date_fin); $this->date_fin = $this->db->jdate($obj->date_fin);
$this->date_debut_gmt = $this->db->jdate($obj->date_debut,1);
$this->date_fin_gmt = $this->db->jdate($obj->date_fin,1);
$this->halfday = $obj->halfday; $this->halfday = $obj->halfday;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->fk_validator = $obj->fk_validator; $this->fk_validator = $obj->fk_validator;
@ -317,6 +321,8 @@ class Holiday extends CommonObject
$tab_result[$i]['description'] = $obj->description; $tab_result[$i]['description'] = $obj->description;
$tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut); $tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut);
$tab_result[$i]['date_fin'] = $this->db->jdate($obj->date_fin); $tab_result[$i]['date_fin'] = $this->db->jdate($obj->date_fin);
$tab_result[$i]['date_debut_gmt'] = $this->db->jdate($obj->date_debut,1);
$tab_result[$i]['date_fin_gmt'] = $this->db->jdate($obj->date_fin,1);
$tab_result[$i]['halfday'] = $obj->halfday; $tab_result[$i]['halfday'] = $obj->halfday;
$tab_result[$i]['statut'] = $obj->statut; $tab_result[$i]['statut'] = $obj->statut;
$tab_result[$i]['fk_validator'] = $obj->fk_validator; $tab_result[$i]['fk_validator'] = $obj->fk_validator;
@ -426,6 +432,8 @@ class Holiday extends CommonObject
$tab_result[$i]['description'] = $obj->description; $tab_result[$i]['description'] = $obj->description;
$tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut); $tab_result[$i]['date_debut'] = $this->db->jdate($obj->date_debut);
$tab_result[$i]['date_fin'] = $this->db->jdate($obj->date_fin); $tab_result[$i]['date_fin'] = $this->db->jdate($obj->date_fin);
$tab_result[$i]['date_debut_gmt'] = $this->db->jdate($obj->date_debut,1);
$tab_result[$i]['date_fin_gmt'] = $this->db->jdate($obj->date_fin,1);
$tab_result[$i]['halfday'] = $obj->halfday; $tab_result[$i]['halfday'] = $obj->halfday;
$tab_result[$i]['statut'] = $obj->statut; $tab_result[$i]['statut'] = $obj->statut;
$tab_result[$i]['fk_validator'] = $obj->fk_validator; $tab_result[$i]['fk_validator'] = $obj->fk_validator;

View File

@ -64,6 +64,8 @@ if ($action == 'create')
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
$date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1);
$date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1);
$starthalfday=GETPOST('starthalfday'); $starthalfday=GETPOST('starthalfday');
$endhalfday=GETPOST('endhalfday'); $endhalfday=GETPOST('endhalfday');
$halfday=0; $halfday=0;
@ -105,7 +107,7 @@ if ($action == 'create')
} }
// Si aucun jours ouvrés dans la demande // Si aucun jours ouvrés dans la demande
$nbopenedday=num_open_day($date_debut, $date_fin, 0, 1, $halfday); $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
if($nbopenedday < 1) if($nbopenedday < 1)
{ {
header('Location: fiche.php?action=request&error=DureeHoliday'); header('Location: fiche.php?action=request&error=DureeHoliday');
@ -147,6 +149,8 @@ if ($action == 'update')
{ {
$date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year')); $date_debut = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'));
$date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year')); $date_fin = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'));
$date_debut_gmt = dol_mktime(0, 0, 0, GETPOST('date_debut_month'), GETPOST('date_debut_day'), GETPOST('date_debut_year'), 1);
$date_fin_gmt = dol_mktime(0, 0, 0, GETPOST('date_fin_month'), GETPOST('date_fin_day'), GETPOST('date_fin_year'), 1);
$starthalfday=GETPOST('starthalfday'); $starthalfday=GETPOST('starthalfday');
$endhalfday=GETPOST('endhalfday'); $endhalfday=GETPOST('endhalfday');
$halfday=0; $halfday=0;
@ -198,7 +202,7 @@ if ($action == 'update')
} }
// Si pas de jours ouvrés dans la demande // Si pas de jours ouvrés dans la demande
$nbopenedday=num_open_day($date_debut, $date_fin, 0, 1, $halfday); $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
if ($nbopenedday < 1) if ($nbopenedday < 1)
{ {
header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday'); header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday');
@ -331,7 +335,7 @@ if ($action == 'confirm_send')
// Si l'option pour avertir le valideur en cas de solde inférieur à la demande // Si l'option pour avertir le valideur en cas de solde inférieur à la demande
if ($cp->getConfCP('AlertValidatorSolde')) if ($cp->getConfCP('AlertValidatorSolde'))
{ {
$nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1,$cp->halfday); $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday);
if ($nbopenedday > $cp->getCPforUser($cp->fk_user)) if ($nbopenedday > $cp->getCPforUser($cp->fk_user))
{ {
$message.= "\n"; $message.= "\n";
@ -387,7 +391,7 @@ if($action == 'confirm_valid')
if ($verif > 0) if ($verif > 0)
{ {
// Calculcate number of days consummed // Calculcate number of days consummed
$nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1); $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1);
$soldeActuel = $cp->getCpforUser($cp->fk_user); $soldeActuel = $cp->getCpforUser($cp->fk_user);
$newSolde = $soldeActuel - ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); $newSolde = $soldeActuel - ($nbopenedday * $cp->getConfCP('nbHolidayDeducted'));
@ -552,7 +556,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold if ($result >= 0 && $oldstatus == 3) // holiday was already validated, status 3, so we must increase back sold
{ {
// Calculcate number of days consummed // Calculcate number of days consummed
$nbopenedday=num_open_day($cp->date_debut,$cp->date_fin,0,1,$cp->halfday); $nbopenedday=num_open_day($cp->date_debut_gmt,$cp->date_fin_gmt,0,1,$cp->halfday);
$soldeActuel = $cp->getCpforUser($cp->fk_user); $soldeActuel = $cp->getCpforUser($cp->fk_user);
$newSolde = $soldeActuel + ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); $newSolde = $soldeActuel + ($nbopenedday * $cp->getConfCP('nbHolidayDeducted'));
@ -979,7 +983,7 @@ else
} }
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('NbUseDaysCP').'</td>'; print '<td>'.$langs->trans('NbUseDaysCP').'</td>';
print '<td>'.num_open_day($cp->date_debut, $cp->date_fin, 0, 1, $cp->halfday).'</td>'; print '<td>'.num_open_day($cp->date_debut_gmt, $cp->date_fin_gmt, 0, 1, $cp->halfday).'</td>';
print '</tr>'; print '</tr>';
// Status // Status

View File

@ -366,7 +366,7 @@ if (! empty($holiday->holiday))
print '<td align="center">'.dol_print_date($infos_CP['date_debut'],'day').'</td>'; print '<td align="center">'.dol_print_date($infos_CP['date_debut'],'day').'</td>';
print '<td align="center">'.dol_print_date($infos_CP['date_fin'],'day').'</td>'; print '<td align="center">'.dol_print_date($infos_CP['date_fin'],'day').'</td>';
print '<td align="right">'; print '<td align="right">';
$nbopenedday=num_open_day($infos_CP['date_debut'], $infos_CP['date_fin'], 0, 1, $infos_CP['halfday']); $nbopenedday=num_open_day($infos_CP['date_debut_gmt'], $infos_CP['date_fin_gmt'], 0, 1, $infos_CP['halfday']);
print $nbopenedday.' '.$langs->trans('DurationDays'); print $nbopenedday.' '.$langs->trans('DurationDays');
print '<td align="right" colspan="2">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>'; print '<td align="right" colspan="2">'.$holidaystatic->LibStatut($infos_CP['statut'],5).'</td>';
print '</tr>'."\n"; print '</tr>'."\n";

View File

@ -119,13 +119,8 @@ if($num == '0') {
$start_date=$db->jdate($holiday['date_debut']); $start_date=$db->jdate($holiday['date_debut']);
$end_date=$db->jdate($holiday['date_fin']); $end_date=$db->jdate($holiday['date_fin']);
/*if(substr($holiday['date_debut'],5,2)==$month-1){ $start_date_gmt=$db->jdate($holiday['date_debut'],1);
$holiday['date_debut'] = date('Y-'.$month.'-01'); $end_date_gmt=$db->jdate($holiday['date_fin'],1);
}
if(substr($holiday['date_fin'],5,2)==$month+1){
$holiday['date_fin'] = date('Y-'.$month.'-t');
}*/
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'.$holidaystatic->getNomUrl(1).'</td>'; print '<td>'.$holidaystatic->getNomUrl(1).'</td>';
@ -135,7 +130,7 @@ if($num == '0') {
print '<td>'.dol_print_date($end_date,'day'); print '<td>'.dol_print_date($end_date,'day');
print '</td>'; print '</td>';
print '<td align="right">'; print '<td align="right">';
$nbopenedday=num_open_day($start_date, $end_date, 0, 1, $holiday['halfday']); $nbopenedday=num_open_day($start_date_gmt, $end_date_gmt, 0, 1, $holiday['halfday']);
print $nbopenedday; print $nbopenedday;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -150,6 +150,18 @@ class DateLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(1,$result); $this->assertEquals(1,$result);
// With different date before and after sunlight hour (day to change is 2014-03-30)
$date1=dol_mktime(0, 0, 0, 3, 28, 2014, true);
$date2=dol_mktime(0, 0, 0, 3, 31, 2014, true);
$result=num_between_day($date1,$date2,1);
print __METHOD__." result=".$result."\n";
$this->assertEquals(4,$result);
$result=num_between_day($date1,$date2,0);
print __METHOD__." result=".$result."\n";
$this->assertEquals(3,$result);
return $result; return $result;
} }