39 -11 =>
"Pacific/Pago_Pago",
40 -10 =>
"Pacific/Honolulu",
41 -9 =>
"America/Anchorage",
42 -8 =>
"America/Los_Angeles",
43 -7 =>
"America/Dawson_Creek",
44 -6 =>
"America/Chicago",
45 -5 =>
"America/Bogota",
46 -4 =>
"America/Asuncion",
47 -3 =>
"America/Araguaina",
48 -2 =>
"America/Noronha",
49 -1 =>
"Atlantic/Azores",
52 2 =>
"Europe/Helsinki",
58 8 =>
"Asia/Hong_Kong",
60 10 =>
"Australia/Sydney",
61 11 =>
"Pacific/Noumea",
62 12 =>
"Pacific/Auckland",
63 13 =>
"Pacific/Fakaofo",
64 14 =>
"Pacific/Kiritimati"
77 return @date_default_timezone_get();
88 if (method_exists(
'DateTimeZone',
'getOffset')) {
94 if ($refgmtdate ==
'now') {
95 $newrefgmtdate = $yearref.
'-'.$monthref.
'-'.$dayref;
96 } elseif ($refgmtdate ==
'summer') {
97 $newrefgmtdate = $yearref.
'-08-01';
99 $newrefgmtdate = $yearref.
'-01-01';
101 $newrefgmtdate .=
'T00:00:00+00:00';
103 $localdt =
new DateTime($newrefgmtdate, $localtz);
104 $tmp = -1 * $localtz->getOffset($localdt);
110 $tz = round(($tmp < 0 ? 1 : -1) * abs($tmp / 3600));
127 if (empty($duration_value)) {
130 if ($duration_unit ==
's') {
131 return $time + (int) ($duration_value);
133 if ($duration_unit ==
'i') {
134 return $time + (int) (60 * $duration_value);
136 if ($duration_unit ==
'h') {
137 return $time + (int) (3600 * $duration_value);
139 if ($duration_unit ==
'w') {
140 return $time + (int) (3600 * 24 * 7 * $duration_value);
145 if ($duration_value > 0) {
146 $deltastring .= abs($duration_value);
149 if ($duration_value < 0) {
150 $deltastring .= abs($duration_value);
153 if ($duration_unit ==
'd') {
156 if ($duration_unit ==
'm') {
159 if ($duration_unit ==
'y') {
163 $date =
new DateTime();
165 $date->setTimezone(
new DateTimeZone(
'UTC'));
167 $date->setTimestamp($time);
168 $interval =
new DateInterval($deltastring);
171 $date->sub($interval);
173 $date->add($interval);
176 if ($ruleforendofmonth == 1 && $duration_unit ==
'm') {
179 $timetotalmonths = (($timeyear * 12) + $timemonth);
181 $monthsexpected = ($timetotalmonths + $duration_value);
183 $newtime = $date->getTimestamp();
187 $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
189 if ($monthsexpected < $newtimetotalmonths) {
194 $datelim =
dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
195 $datelim -= (3600 * 24);
197 $date->setTimestamp($datelim);
200 return $date->getTimestamp();
215 $iResult = ((int) $iHours * 3600) + ((int) $iMinutes * 60) + (int) $iSeconds;
246 if (empty($lengthOfDay)) {
247 $lengthOfDay = 86400;
249 if (empty($lengthOfWeek)) {
252 $nbHbyDay = $lengthOfDay / 3600;
254 if ($format ==
'all' || $format ==
'allwithouthour' || $format ==
'allhour' || $format ==
'allhourmin' || $format ==
'allhourminsec') {
255 if ((
int) $iSecond === 0) {
263 if ($iSecond >= $lengthOfDay) {
264 for ($i = $iSecond; $i >= $lengthOfDay; $i -= $lengthOfDay) {
266 $iSecond -= $lengthOfDay;
268 $dayTranslate = $langs->trans(
"Day");
269 if ($iSecond >= ($lengthOfDay * 2)) {
270 $dayTranslate = $langs->trans(
"Days");
274 if ($lengthOfWeek < 7) {
276 if ($sDay >= $lengthOfWeek) {
277 $sWeek = (int) (($sDay - $sDay % $lengthOfWeek) / $lengthOfWeek);
278 $sDay %= $lengthOfWeek;
279 $weekTranslate = $langs->trans(
"DurationWeek");
281 $weekTranslate = $langs->trans(
"DurationWeeks");
283 $sTime .= $sWeek.
' '.$weekTranslate.
' ';
288 $dayTranslate = $langs->trans(
"Day");
290 $dayTranslate = $langs->trans(
"Days");
292 $sTime .= $sDay.
' '.$langs->trans(
"d").
' ';
295 if ($format ==
'all') {
296 if ($iSecond || empty($sDay)) {
299 } elseif ($format ==
'allhourminsec') {
300 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond / 3600))).
':'.sprintf(
"%02d", ((
int) floor(($iSecond % 3600) / 60))).
':'.sprintf(
"%02d", ((
int) ($iSecond % 60)));
301 } elseif ($format ==
'allhourmin') {
302 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond / 3600))).
':'.sprintf(
"%02d", ((
int) floor(($iSecond % 3600) / 60)));
303 } elseif ($format ==
'allhour') {
304 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond / 3600)));
306 } elseif ($format ==
'hour') {
308 } elseif ($format ==
'fullhour') {
309 if (!empty($iSecond)) {
315 } elseif ($format ==
'min') {
317 } elseif ($format ==
'sec') {
319 } elseif ($format ==
'month') {
321 } elseif ($format ==
'year') {
338 if ($duration_unit ==
's') {
339 $result = $duration_value / 3600;
341 if ($duration_unit ==
'i') {
342 $result = $duration_value / 60;
344 if ($duration_unit ==
'h') {
345 $result = $duration_value;
347 if ($duration_unit ==
'd') {
348 $result = $duration_value * 24;
350 if ($duration_unit ==
'w') {
351 $result = $duration_value * 24 * 7;
353 if ($duration_unit ==
'm') {
354 $result = $duration_value * 730.484;
356 if ($duration_unit ==
'y') {
357 $result = $duration_value * 365 * 24;
378function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand = 0, $gm =
false)
383 $day_date = intval($day_date);
384 $month_date = intval($month_date);
385 $year_date = intval($year_date);
387 if ($month_date > 0) {
388 if ($month_date > 12) {
391 if ($year_date > 0 && empty($day_date)) {
392 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_get_first_day($year_date, $month_date, $gm));
393 $sqldate .=
"' AND '".$db->idate(
dol_get_last_day($year_date, $month_date, $gm)).
"'";
394 } elseif ($year_date > 0 && !empty($day_date)) {
395 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month_date, $day_date, $year_date, $gm));
396 $sqldate .=
"' AND '".$db->idate(
dol_mktime(23, 59, 59, $month_date, $day_date, $year_date, $gm)).
"'";
399 $sqldate .= ($excludefirstand ?
"" :
" AND ").
" date_format( ".$datefield.
", '%c') = '".$db->escape($month_date).
"'";
401 } elseif ($year_date > 0) {
402 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_get_first_day($year_date, 1, $gm));
403 $sqldate .=
"' AND '".$db->idate(
dol_get_last_day($year_date, 12, $gm)).
"'";
431 if (preg_match(
'/^([0-9]+)\/([0-9]+)\/([0-9]+)\s?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $string, $reg)) {
432 dol_syslog(
"dol_stringtotime call to function with deprecated parameter format", LOG_WARNING);
435 $sday = (int) $reg[1];
436 $smonth = (int) $reg[2];
437 $syear = (int) $reg[3];
438 $shour = (int) $reg[4];
439 $smin = (int) $reg[5];
440 $ssec = (int) $reg[6];
444 if ($syear >= 50 && $syear < 100) {
447 $string = sprintf(
"%04d%02d%02d%02d%02d%02d", $syear, $smonth, $sday, $shour, $smin, $ssec);
448 } elseif (preg_match(
'/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z$/i', $string, $reg)
449 || preg_match(
'/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/i', $string, $reg)
450 || preg_match(
'/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2})([0-9]{2})([0-9]{2})Z$/i', $string, $reg)
452 $syear = (int) $reg[1];
453 $smonth = (int) $reg[2];
454 $sday = (int) $reg[3];
455 $shour = (int) $reg[4];
456 $smin = (int) $reg[5];
457 $ssec = (int) $reg[6];
458 $string = sprintf(
"%04d%02d%02d%02d%02d%02d", $syear, $smonth, $sday, $shour, $smin, $ssec);
461 $string = preg_replace(
'/([^0-9])/i',
'', $string);
462 $tmp = $string.
'000000';
466 } elseif (empty($gm) || $gm ===
'tzserver') {
470 $date =
dol_mktime((
int) substr($tmp, 8, 2), (
int) substr($tmp, 10, 2), (
int) substr($tmp, 12, 2), (
int) substr($tmp, 4, 2), (
int) substr($tmp, 6, 2), (
int) substr($tmp, 0, 4), $gm);
486 $time =
dol_mktime(12, 0, 0, $month, $day, $year, 1, 0);
487 $time -= 24 * 60 * 60;
489 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
502 $time =
dol_mktime(12, 0, 0, $month, $day, $year, 1, 0);
503 $time += 24 * 60 * 60;
505 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
519 $prev_year = $year - 1;
521 $prev_month = $month - 1;
524 return array(
'year' => $prev_year,
'month' => $prev_month);
538 $next_year = $year + 1;
540 $next_month = $month + 1;
543 return array(
'year' => $next_year,
'month' => $next_month);
559 $time =
dol_mktime(12, 0, 0, $month, $tmparray[
'first_day'], $year, 1, 0);
560 $time -= 24 * 60 * 60 * 7;
562 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
578 $time =
dol_mktime(12, 0, 0, $tmparray[
'first_month'], $tmparray[
'first_day'], $tmparray[
'first_year'], 1, 0);
579 $time += 24 * 60 * 60 * 7;
582 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
601 return dol_mktime(0, 0, 0, $month, 1, $year, $gm);
628 $datelim =
dol_mktime(23, 59, 59, $month, 1, $year, $gm);
629 $datelim -= (3600 * 24);
644 $tmparray =
dol_getdate($date,
false, ($gm ==
'gmt' ?
'gmt' :
''));
645 return dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year'], $gm);
658 $tmparray =
dol_getdate($date,
false, ($gm ==
'gmt' ?
'gmt' :
''));
659 return dol_mktime(0, 0, 0, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year'], $gm);
676 $date =
dol_mktime(0, 0, 0, $month, $day, $year, $gm);
679 $start_week = (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1);
684 $days = $start_week - $tmparray[
'wday'];
689 $seconds = $days * 24 * 60 * 60;
693 $tmpdaytms = (int) date((
string) $tmparray[
'0']) - $seconds;
694 $tmpday = idate(
"d", $tmpdaytms);
697 if ($tmpday > $day) {
698 $prev_month = $month - 1;
701 if ($prev_month == 0) {
703 $prev_year = $year - 1;
706 $prev_month = $month;
709 $tmpmonth = $prev_month;
710 $tmpyear = $prev_year;
713 $tmptime =
dol_mktime(12, 0, 0, $month, $tmpday, $year, 1, 0);
714 $tmptime -= 24 * 60 * 60 * 7;
716 $prev_day = $tmparray[
'mday'];
719 if ($prev_day > $tmpday) {
720 $prev_month = $month - 1;
723 if ($prev_month == 0) {
725 $prev_year = $year - 1;
729 $week = date(
"W",
dol_mktime(0, 0, 0, $tmpmonth, $tmpday, $tmpyear, $gm));
731 return array(
'year' => $year,
'month' => $month,
'week' => $week,
'first_day' => $tmpday,
'first_month' => $tmpmonth,
'first_year' => $tmpyear,
'prev_year' => $prev_year,
'prev_month' => $prev_month,
'prev_day' => $prev_day);
743 $base =
new DateTime(
"$year-03-21",
new DateTimeZone(
"UTC"));
744 $days = easter_days($year);
745 $tmp = $base->add(
new DateInterval(
"P{$days}D"));
746 return $tmp->getTimestamp();
765function num_public_holiday($timestampStart, $timestampEnd, $country_code =
'', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1, $includemonday = -1)
767 global $conf, $db, $mysoc;
772 if (($timestampEnd - $timestampStart) % 86400 != 0) {
773 return 'Error Dates must use same hours and must be GMT dates';
776 if (empty($country_code)) {
777 $country_code = $mysoc->country_code;
779 if ($includemonday < 0) {
780 $includemonday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', 0);
782 if ($includefriday < 0) {
783 $includefriday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', 0);
785 if ($includesaturday < 0) {
786 $includesaturday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', 1);
788 if ($includesunday < 0) {
789 $includesunday =
getDolGlobalInt(
'MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', 1);
792 $country_id =
dol_getIdFromCode($db, $country_code,
'c_country',
'code',
'rowid');
794 if (empty($conf->cache[
'arrayOfActivePublicHolidays_'.$country_id])) {
796 $tmpArrayOfPublicHolidays = array();
797 $sql =
"SELECT id, code, entity, fk_country, dayrule, year, month, day, active";
798 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_hrm_public_holiday";
799 $sql .=
" WHERE active = 1 and fk_country IN (0".($country_id > 0 ?
", ".$country_id : 0).
")";
800 $sql .=
" AND entity IN (0," .getEntity(
'holiday') .
")";
802 $resql = $db->query($sql);
804 $num_rows = $db->num_rows($resql);
806 while ($i < $num_rows) {
807 $obj = $db->fetch_object($resql);
808 $tmpArrayOfPublicHolidays[$obj->id] = array(
'dayrule' => $obj->dayrule,
'year' => $obj->year,
'month' => $obj->month,
'day' => $obj->day);
813 return 'Error sql '.$db->lasterror();
817 $conf->cache[
'arrayOfActivePublicHolidays_'.$country_id] = $tmpArrayOfPublicHolidays;
820 $arrayOfPublicHolidays = $conf->cache[
'arrayOfActivePublicHolidays_'.$country_id];
823 while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd))
826 $specialdayrule = array();
828 $jour = (int) gmdate(
"d", $timestampStart);
829 $mois = (int) gmdate(
"m", $timestampStart);
830 $annee = (int) gmdate(
"Y", $timestampStart);
833 foreach ($arrayOfPublicHolidays as $entrypublicholiday) {
834 if (!empty($entrypublicholiday[
'dayrule']) && $entrypublicholiday[
'dayrule'] !=
'date') {
835 $specialdayrule[$entrypublicholiday[
'dayrule']] = $entrypublicholiday[
'dayrule'];
838 if (!empty($entrypublicholiday[
'year']) && $entrypublicholiday[
'year'] != $annee) {
841 if ($entrypublicholiday[
'month'] != $mois) {
844 if ($entrypublicholiday[
'day'] != $jour) {
860 if (in_array(
'easter', $specialdayrule)) {
863 $jour_paques = gmdate(
"d", $date_paques);
864 $mois_paques = gmdate(
"m", $date_paques);
865 if ($jour_paques == $jour && $mois_paques == $mois) {
871 if (in_array(
'eastermonday', $specialdayrule)) {
875 $date_lundi_paques = $date_paques + (3600 * 24);
876 $jour_lundi_paques = gmdate(
"d", $date_lundi_paques);
877 $mois_lundi_paques = gmdate(
"m", $date_lundi_paques);
878 if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) {
886 if (in_array(
'goodfriday', $specialdayrule)) {
891 $date_good_friday = $easter - (2 * 3600 * 24);
892 $dom_good_friday = gmdate(
"d", $date_good_friday);
893 $month_good_friday = gmdate(
"m", $date_good_friday);
895 if ($dom_good_friday == $jour && $month_good_friday == $mois) {
900 if (in_array(
'ascension', $specialdayrule)) {
903 $date_ascension = $date_paques + (3600 * 24 * 39);
904 $jour_ascension = gmdate(
"d", $date_ascension);
905 $mois_ascension = gmdate(
"m", $date_ascension);
906 if ($jour_ascension == $jour && $mois_ascension == $mois) {
912 if (in_array(
'pentecost', $specialdayrule)) {
915 $date_pentecote = $date_paques + (3600 * 24 * 49);
916 $jour_pentecote = gmdate(
"d", $date_pentecote);
917 $mois_pentecote = gmdate(
"m", $date_pentecote);
918 if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
923 if (in_array(
'pentecotemonday', $specialdayrule)) {
926 $date_pentecote = $date_paques + (3600 * 24 * 50);
927 $jour_pentecote = gmdate(
"d", $date_pentecote);
928 $mois_pentecote = gmdate(
"m", $date_pentecote);
929 if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
935 if (in_array(
'viernessanto', $specialdayrule)) {
938 $date_viernes = $date_paques - (3600 * 24 * 2);
939 $jour_viernes = gmdate(
"d", $date_viernes);
940 $mois_viernes = gmdate(
"m", $date_viernes);
941 if ($jour_viernes == $jour && $mois_viernes == $mois) {
947 if (in_array(
'fronleichnam', $specialdayrule)) {
950 $date_fronleichnam = $date_paques + (3600 * 24 * 60);
951 $jour_fronleichnam = gmdate(
"d", $date_fronleichnam);
952 $mois_fronleichnam = gmdate(
"m", $date_fronleichnam);
953 if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) {
959 if (in_array(
'genevafast', $specialdayrule)) {
961 $date_1sunsept = strtotime(
'next thursday', strtotime(
'next sunday', mktime(0, 0, 0, 9, 1, $annee)));
962 $jour_1sunsept = date(
"d", $date_1sunsept);
963 $mois_1sunsept = date(
"m", $date_1sunsept);
964 if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) {
974 if ($includefriday || $includesaturday || $includesunday) {
975 $jour_julien = unixtojd($timestampStart);
976 $jour_semaine = jddayofweek($jour_julien, 0);
977 if ($includefriday) {
978 if ($jour_semaine == 5) {
982 if ($includesaturday) {
983 if ($jour_semaine == 6) {
987 if ($includesunday) {
988 if ($jour_semaine == 0) {
1024 if ($timestampStart < $timestampEnd) {
1025 if ($lastday == 1) {
1030 $nbjours = (int) floor(($timestampEnd - $timestampStart) / (60 * 60 * 24)) + 1 - $bit;
1050function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, $halfday = 0, $country_code =
'')
1052 global $langs, $mysoc;
1054 if (empty($country_code)) {
1055 $country_code = $mysoc->country_code;
1058 dol_syslog(
'num_open_day timestampStart='.$timestampStart.
' timestampEnd='.$timestampEnd.
' bit='.$lastday.
' country_code='.$country_code);
1061 if (!is_int($timestampStart) && !is_float($timestampStart)) {
1062 return 'ErrorBadParameter_num_open_day';
1064 if (!is_int($timestampEnd) && !is_float($timestampEnd)) {
1065 return 'ErrorBadParameter_num_open_day';
1069 if ($timestampStart < $timestampEnd) {
1072 $numholidays =
num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
1073 $nbOpenDay = ($numdays - $numholidays);
1074 if ($inhour == 1 && $nbOpenDay <= 3) {
1077 return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
1078 } elseif ($timestampStart == $timestampEnd) {
1081 $numholidays =
num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
1082 if ($numholidays == 1) {
1087 $nbOpenDay = $lastday;
1092 return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
1094 return $langs->trans(
"Error");
1110 $montharray = array(
1111 1 => $outputlangs->trans(
"Month01"),
1112 2 => $outputlangs->trans(
"Month02"),
1113 3 => $outputlangs->trans(
"Month03"),
1114 4 => $outputlangs->trans(
"Month04"),
1115 5 => $outputlangs->trans(
"Month05"),
1116 6 => $outputlangs->trans(
"Month06"),
1117 7 => $outputlangs->trans(
"Month07"),
1118 8 => $outputlangs->trans(
"Month08"),
1119 9 => $outputlangs->trans(
"Month09"),
1120 10 => $outputlangs->trans(
"Month10"),
1121 11 => $outputlangs->trans(
"Month11"),
1122 12 => $outputlangs->trans(
"Month12")
1125 if (!empty($short)) {
1126 $montharray = array(
1127 1 => $outputlangs->trans(
"MonthShort01"),
1128 2 => $outputlangs->trans(
"MonthShort02"),
1129 3 => $outputlangs->trans(
"MonthShort03"),
1130 4 => $outputlangs->trans(
"MonthShort04"),
1131 5 => $outputlangs->trans(
"MonthShort05"),
1132 6 => $outputlangs->trans(
"MonthShort06"),
1133 7 => $outputlangs->trans(
"MonthShort07"),
1134 8 => $outputlangs->trans(
"MonthShort08"),
1135 9 => $outputlangs->trans(
"MonthShort09"),
1136 10 => $outputlangs->trans(
"MonthShort10"),
1137 11 => $outputlangs->trans(
"MonthShort11"),
1138 12 => $outputlangs->trans(
"MonthShort12")
1154 $nb_days = cal_days_in_month(CAL_GREGORIAN, $month, $year);
1156 for ($day = 1; $day < $nb_days; $day++) {
1158 $TWeek[$week_number] = $week_number;
1172 $TFirstDayOfWeek = array();
1173 foreach ($TWeek as $weekNb) {
1174 if (in_array(
'01', $TWeek) && in_array(
'52', $TWeek) && $weekNb ==
'01') {
1177 $TFirstDayOfWeek[$weekNb] = date(
'd', strtotime($year.
'W'.$weekNb));
1179 return $TFirstDayOfWeek;
1191 $TLastDayOfWeek = array();
1192 foreach ($TWeek as $weekNb) {
1193 $TLastDayOfWeek[$weekNb] = date(
'd', strtotime($year.
'W'.$weekNb.
'+6 days'));
1195 return $TLastDayOfWeek;
1208 $date =
new DateTime($year.
'-'.$month.
'-'.$day);
1209 $week = $date->format(
"W");
dol_get_prev_month($month, $year)
Return previous month.
dol_get_first_hour($date, $gm='tzserver')
Return GMT time for first hour of a given GMT date (it removes hours, min and second part)
dol_get_next_day($day, $month, $year)
Return next day.
dol_get_next_week($day, $week, $month, $year)
Return next week.
dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand=0, $gm=false)
Generate a SQL string to make a filter into a range (for second of date until last second of date).
getServerTimeZoneString()
Return server timezone string.
dol_get_last_hour($date, $gm='tzserver')
Return GMT time for last hour of a given GMT date (it replaces hours, min and second part to 23:59:59...
getLastDayOfEachWeek($TWeek, $year)
Return array of last day of weeks.
getWeekNumbersOfMonth($month, $year)
Return array of week numbers.
getServerTimeZoneInt($refgmtdate='now')
Return server timezone int.
dol_get_first_day_week($day, $month, $year, $gm=false)
Return first day of week for a date.
getGMTEasterDatetime($year)
Return the easter day in GMT time.
convertDurationtoHour($duration_value, $duration_unit)
Convert duration to hour.
get_tz_array()
Return an array with timezone values.
dol_get_prev_day($day, $month, $year)
Return previous day.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
getFirstDayOfEachWeek($TWeek, $year)
Return array of first day of weeks.
dol_get_next_month($month, $year)
Return next month.
getWeekNumber($day, $month, $year)
Return week number.
num_between_day($timestampStart, $timestampEnd, $lastday=0)
Function to return number of days between two dates (date must be UTC date !) Example: 2012-01-01 201...
convertTime2Seconds($iHours=0, $iMinutes=0, $iSeconds=0)
Convert hours and minutes into seconds.
num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $halfday=0, $country_code='')
Function to return number of working days (and text of units) between two dates (working days)
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_get_prev_week($day, $week, $month, $year)
Return previous week.
dol_stringtotime($string, $gm=1)
Convert a string date into a GM Timestamps date Warning: YYYY-MM-DDTHH:MM:SS+02:00 (RFC3339) is not s...
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
monthArray($outputlangs, $short=0)
Return array of translated months or selected month.
num_public_holiday($timestampStart, $timestampEnd, $country_code='', $lastday=0, $includesaturday=-1, $includesunday=-1, $includefriday=-1, $includemonday=-1)
Return the number of non working days including Friday, Saturday and Sunday (or not) between 2 dates ...
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.