diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index 4be805c379e..2a4fe0b57e8 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -382,13 +382,15 @@ interface Database ); /** - * Convert (by PHP) a PHP server TZ string date into a GM Timestamps date - * 19700101020000 -> 3600 with TZ+1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @return date Date TMS - */ - function jdate($string); + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 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 int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @return date Date TMS + */ + function jdate($string, $gm=false); /** * Encrypt sensitive data in database diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index e80c2957088..0e1b1a2ca0c 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -553,20 +553,22 @@ class DoliDBMssql extends DoliDB 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 - * 19700101020000 -> 3600 with TZ+1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @return date Date TMS - */ - function jdate($string) - { - $string=preg_replace('/([^0-9])/i','',$string); - $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)); - return $date; - } + /** + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 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 int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @return date Date TMS + */ + function jdate($string, $gm=false) + { + $string=preg_replace('/([^0-9])/i','',$string); + $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 diff --git a/htdocs/core/db/mysql.class.php b/htdocs/core/db/mysql.class.php index 5ff714cef7b..a0507072056 100644 --- a/htdocs/core/db/mysql.class.php +++ b/htdocs/core/db/mysql.class.php @@ -531,20 +531,22 @@ class DoliDBMysql extends DoliDB 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 - * 19700101020000 -> 3600 with TZ+1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @return date Date TMS - */ - function jdate($string) - { - $string=preg_replace('/([^0-9])/i','',$string); - $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)); - return $date; - } + /** + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 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 int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @return date Date TMS + */ + function jdate($string, $gm=false) + { + $string=preg_replace('/([^0-9])/i','',$string); + $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 diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index dc65eddbbd8..5993e31dbd1 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -542,17 +542,19 @@ class DoliDBMysqli extends DoliDB } /** - * Convert (by PHP) a PHP server TZ string date into a GM Timestamps date - * 19700101020000 -> 3600 with TZ+1 + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 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 + * @return date Date TMS */ - function jdate($string) + function jdate($string, $gm=false) { $string=preg_replace('/([^0-9])/i','',$string); $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; } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index eb3677b5f6d..aa31f5616c8 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -752,20 +752,22 @@ class DoliDBPgsql extends DoliDB 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 - * 19700101020000 -> 3600 with TZ+1 - * - * @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) - * @return date Date TMS - */ - function jdate($string) - { - $string=preg_replace('/([^0-9])/i','',$string); - $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)); - return $date; - } + /** + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 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 int $gm 1=Input informations are GMT values, otherwise local to server TZ + * @return date Date TMS + */ + function jdate($string, $gm=false) + { + $string=preg_replace('/([^0-9])/i','',$string); + $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 diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index b3a9e35cf1f..84b8742eb75 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -675,20 +675,23 @@ class DoliDBSqlite extends DoliDB } /** - * Convert (by PHP) a PHP server TZ string date into a GM Timestamps date - * 19700101020000 -> 3600 with TZ+1 + * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) + * 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 + * @return date Date TMS */ - function jdate($string) + function jdate($string, $gmt=false) { $string=preg_replace('/([^0-9])/i','',$string); $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; } + /** * Format a SQL IF * diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 78551dac105..9e28fda317b 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -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 * - * @param timestamp $timestampStart Timestamp de debut - * @param timestamp $timestampEnd Timestamp de fin + * @param timestamp $timestampStart Timestamp start UTC + * @param timestamp $timestampEnd Timestamp end UTC * @param int $lastday Last day is included, 0: non, 1:oui * @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) * - * @param timestamp $timestampStart Timestamp for start date - * @param timestamp $timestampEnd Timestamp for end date - * @param int $inhour 0: return number of days, 1: return number of hours (72h max) + * @param timestamp $timestampStart Timestamp for start date (date must be UTC to avoid calculation errors) + * @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 * @param int $lastday We include last day, 0: no, 1:yes * @param int $halfday Tag to define half day when holiday start and end * @return int Number of days or hours diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 024ab5c30a9..cb8af8c78b3 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -44,8 +44,10 @@ class Holiday extends CommonObject var $fk_user; var $date_create=''; var $description; - var $date_debut=''; - var $date_fin=''; + var $date_debut=''; // Date start in PHP server TZ + 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 $statut=''; // 1=draft, 2=validated, 3=approved var $fk_validator; @@ -214,6 +216,8 @@ class Holiday extends CommonObject $this->description = $obj->description; $this->date_debut = $this->db->jdate($obj->date_debut); $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->statut = $obj->statut; $this->fk_validator = $obj->fk_validator; @@ -317,6 +321,8 @@ class Holiday extends CommonObject $tab_result[$i]['description'] = $obj->description; $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_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]['statut'] = $obj->statut; $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]['date_debut'] = $this->db->jdate($obj->date_debut); $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]['statut'] = $obj->statut; $tab_result[$i]['fk_validator'] = $obj->fk_validator; diff --git a/htdocs/holiday/fiche.php b/htdocs/holiday/fiche.php index 01c2e1fb5a1..e921237583a 100644 --- a/htdocs/holiday/fiche.php +++ b/htdocs/holiday/fiche.php @@ -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_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'); $endhalfday=GETPOST('endhalfday'); $halfday=0; @@ -105,7 +107,7 @@ if ($action == 'create') } // 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) { 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_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'); $endhalfday=GETPOST('endhalfday'); $halfday=0; @@ -198,7 +202,7 @@ if ($action == 'update') } // 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) { header('Location: fiche.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday'); @@ -237,9 +241,9 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes') if($user->rights->holiday->delete) { $error=0; - + $db->begin(); - + $cp = new Holiday($db); $cp->fetch($id); @@ -251,12 +255,12 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes') { $result=$cp->delete($id); } - else + else { $error = $langs->trans('ErrorCantDeleteCP'); } } - + if (! $error) { $db->commit(); @@ -265,7 +269,7 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes') } else { - $db->rollback(); + $db->rollback(); } } } @@ -331,7 +335,7 @@ if ($action == 'confirm_send') // Si l'option pour avertir le valideur en cas de solde inférieur à la demande 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)) { $message.= "\n"; @@ -384,10 +388,10 @@ if($action == 'confirm_valid') $verif = $cp->update($user->id); // Si pas d'erreur SQL on redirige vers la fiche de la demande - if ($verif > 0) + if ($verif > 0) { // 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); $newSolde = $soldeActuel - ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); @@ -470,7 +474,7 @@ if ($action == 'confirm_refuse') $verif = $cp->update($user->id); // Si pas d'erreur SQL on redirige vers la fiche de la demande - if ($verif > 0) + if ($verif > 0) { // To $destinataire = new User($db); @@ -541,7 +545,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') if (($cp->statut == 2 || $cp->statut == 3) && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user)) { $db->begin(); - + $oldstatus = $cp->statut; $cp->date_cancel = dol_now(); $cp->fk_user_cancel = $user->id; @@ -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 { // 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); $newSolde = $soldeActuel + ($nbopenedday * $cp->getConfCP('nbHolidayDeducted')); @@ -568,16 +572,16 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes') $error = $langs->trans('ErrorCantDeleteCP'); } } - + if (! $error) { - $db->commit(); + $db->commit(); } else { $db->rollback(); } - + // Si pas d'erreur SQL on redirige vers la fiche de la demande if (! $error && $result > 0) { @@ -874,7 +878,7 @@ else if($user->id == $cp->fk_user || $user->rights->holiday->lire_tous) { - if ($action == 'delete') + if ($action == 'delete') { if($user->rights->holiday->delete) { @@ -943,8 +947,8 @@ else print $langs->trans($listhalfday[$starthalfday]); print ''; print ''; - } - else + } + else { print ''; print ''.$langs->trans('DateDebCP').' ('.$langs->trans("FirstDayOfHoliday").')'; @@ -965,8 +969,8 @@ else print $langs->trans($listhalfday[$endhalfday]); print ''; print ''; - } - else + } + else { print ''; print ''.$langs->trans('DateFinCP').' ('.$langs->trans("LastDayOfHoliday").')'; @@ -979,7 +983,7 @@ else } print ''; print ''.$langs->trans('NbUseDaysCP').''; - print ''.num_open_day($cp->date_debut, $cp->date_fin, 0, 1, $cp->halfday).''; + print ''.num_open_day($cp->date_debut_gmt, $cp->date_fin_gmt, 0, 1, $cp->halfday).''; print ''; // Status diff --git a/htdocs/holiday/index.php b/htdocs/holiday/index.php index e7c4b0a3d50..d42b9622ee5 100644 --- a/htdocs/holiday/index.php +++ b/htdocs/holiday/index.php @@ -249,7 +249,7 @@ if ($id > 0) } else { print ''; -} +} print '
'."\n"; print ''; @@ -299,7 +299,7 @@ if($user->rights->holiday->lire_tous) $form->select_users($search_valideur,"search_valideur",1,"",0,$valideurarray,''); print ''; } -else +else { print ''; } @@ -366,7 +366,7 @@ if (! empty($holiday->holiday)) print ''; print ''; print ''; print ''."\n"; diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index df9206dfcc5..31b1765cf32 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -119,13 +119,8 @@ if($num == '0') { $start_date=$db->jdate($holiday['date_debut']); $end_date=$db->jdate($holiday['date_fin']); - /*if(substr($holiday['date_debut'],5,2)==$month-1){ - $holiday['date_debut'] = date('Y-'.$month.'-01'); - } - - if(substr($holiday['date_fin'],5,2)==$month+1){ - $holiday['date_fin'] = date('Y-'.$month.'-t'); - }*/ + $start_date_gmt=$db->jdate($holiday['date_debut'],1); + $end_date_gmt=$db->jdate($holiday['date_fin'],1); print ''; print ''; @@ -135,7 +130,7 @@ if($num == '0') { print ''; print ''; print ''; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 470b74df861..d5567ab55b3 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -150,6 +150,18 @@ class DateLibTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result."\n"; $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; }
 '.dol_print_date($infos_CP['date_debut'],'day').''.dol_print_date($infos_CP['date_fin'],'day').''; - $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 ''.$holidaystatic->LibStatut($infos_CP['statut'],5).'
'.$holidaystatic->getNomUrl(1).''.dol_print_date($end_date,'day'); print ''; - $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 '