37 -11 =>
"Pacific/Pago_Pago",
38 -10 =>
"Pacific/Honolulu",
39 -9 =>
"America/Anchorage",
40 -8 =>
"America/Los_Angeles",
41 -7 =>
"America/Dawson_Creek",
42 -6 =>
"America/Chicago",
43 -5 =>
"America/Bogota",
44 -4 =>
"America/Asuncion",
45 -3 =>
"America/Araguaina",
46 -2 =>
"America/Noronha",
47 -1 =>
"Atlantic/Azores",
50 2 =>
"Europe/Helsinki",
56 8 =>
"Asia/Hong_Kong",
58 10 =>
"Australia/Sydney",
59 11 =>
"Pacific/Noumea",
60 12 =>
"Pacific/Auckland",
61 13 =>
"Pacific/Fakaofo",
62 14 =>
"Pacific/Kiritimati"
75 return @date_default_timezone_get();
86 if (method_exists(
'DateTimeZone',
'getOffset')) {
92 if ($refgmtdate ==
'now') {
93 $newrefgmtdate = $yearref.
'-'.$monthref.
'-'.$dayref;
94 } elseif ($refgmtdate ==
'summer') {
95 $newrefgmtdate = $yearref.
'-08-01';
97 $newrefgmtdate = $yearref.
'-01-01';
99 $newrefgmtdate .=
'T00:00:00+00:00';
101 $localdt =
new DateTime($newrefgmtdate, $localtz);
102 $tmp = -1 * $localtz->getOffset($localdt);
108 $tz = round(($tmp < 0 ? 1 : -1) * abs($tmp / 3600));
126 if ($duration_unit ==
's') {
127 return $time + ($duration_value);
129 if ($duration_value == 0) {
132 if ($duration_unit ==
'i') {
133 return $time + (60 * $duration_value);
135 if ($duration_unit ==
'h') {
136 return $time + (3600 * $duration_value);
138 if ($duration_unit ==
'w') {
139 return $time + (3600 * 24 * 7 * $duration_value);
144 if ($duration_value > 0) {
145 $deltastring .= abs($duration_value);
148 if ($duration_value < 0) {
149 $deltastring .= abs($duration_value);
152 if ($duration_unit ==
'd') {
155 if ($duration_unit ==
'm') {
158 if ($duration_unit ==
'y') {
162 $date =
new DateTime();
163 if (!empty($conf->global->MAIN_DATE_IN_MEMORY_ARE_GMT)) {
164 $date->setTimezone(
new DateTimeZone(
'UTC'));
166 $date->setTimestamp($time);
167 $interval =
new DateInterval($deltastring);
170 $date->sub($interval);
172 $date->add($interval);
175 if ($ruleforendofmonth == 1 && $duration_unit ==
'm') {
178 $timetotalmonths = (($timeyear * 12) + $timemonth);
180 $monthsexpected = ($timetotalmonths + $duration_value);
182 $newtime = $date->getTimestamp();
186 $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
188 if ($monthsexpected < $newtimetotalmonths) {
193 $datelim =
dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
194 $datelim -= (3600 * 24);
196 $date->setTimestamp($datelim);
199 return $date->getTimestamp();
214 $iResult = ((int) $iHours * 3600) + ((int) $iMinutes * 60) + (int) $iSeconds;
245 if (empty($lengthOfDay)) {
246 $lengthOfDay = 86400;
248 if (empty($lengthOfWeek)) {
251 $nbHbyDay = $lengthOfDay / 3600;
253 if ($format ==
'all' || $format ==
'allwithouthour' || $format ==
'allhour' || $format ==
'allhourmin' || $format ==
'allhourminsec') {
254 if ((
int) $iSecond === 0) {
262 if ($iSecond >= $lengthOfDay) {
263 for ($i = $iSecond; $i >= $lengthOfDay; $i -= $lengthOfDay) {
265 $iSecond -= $lengthOfDay;
267 $dayTranslate = $langs->trans(
"Day");
268 if ($iSecond >= ($lengthOfDay * 2)) {
269 $dayTranslate = $langs->trans(
"Days");
273 if ($lengthOfWeek < 7) {
275 if ($sDay >= $lengthOfWeek) {
276 $sWeek = (int) (($sDay - $sDay % $lengthOfWeek) / $lengthOfWeek);
277 $sDay = $sDay % $lengthOfWeek;
278 $weekTranslate = $langs->trans(
"DurationWeek");
280 $weekTranslate = $langs->trans(
"DurationWeeks");
282 $sTime .= $sWeek.
' '.$weekTranslate.
' ';
287 $dayTranslate = $langs->trans(
"Day");
289 $dayTranslate = $langs->trans(
"Days");
291 $sTime .= $sDay.
' '.$langs->trans(
"d").
' ';
294 if ($format ==
'all') {
295 if ($iSecond || empty($sDay)) {
298 } elseif ($format ==
'allhourminsec') {
299 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond/3600))).
':'.sprintf(
"%02d", ((
int) floor(($iSecond % 3600) / 60))).
':'.sprintf(
"%02d", ((
int) ($iSecond % 60)));
300 } elseif ($format ==
'allhourmin') {
301 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond/3600))).
':'.sprintf(
"%02d", ((
int) floor(($iSecond % 3600)/60)));
302 } elseif ($format ==
'allhour') {
303 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond/3600)));
305 } elseif ($format ==
'hour') {
307 } elseif ($format ==
'fullhour') {
308 if (!empty($iSecond)) {
309 $iSecond = $iSecond / 3600;
314 } elseif ($format ==
'min') {
316 } elseif ($format ==
'sec') {
318 } elseif ($format ==
'month') {
320 } elseif ($format ==
'year') {
337 if ($duration_unit ==
's') $result = $duration_value / 3600;
338 if ($duration_unit ==
'i') $result = $duration_value / 60;
339 if ($duration_unit ==
'h') $result = $duration_value;
340 if ($duration_unit ==
'd') $result = $duration_value * 24;
341 if ($duration_unit ==
'w') $result = $duration_value * 24 * 7;
342 if ($duration_unit ==
'm') $result = $duration_value * 730.484;
343 if ($duration_unit ==
'y') $result = $duration_value * 365 * 24;
361function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand = 0, $gm =
false)
366 $day_date = intval($day_date);
367 $month_date = intval($month_date);
368 $year_date = intval($year_date);
370 if ($month_date > 0) {
371 if ($month_date > 12) {
374 if ($year_date > 0 && empty($day_date)) {
375 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_get_first_day($year_date, $month_date, $gm));
376 $sqldate .=
"' AND '".$db->idate(
dol_get_last_day($year_date, $month_date, $gm)).
"'";
377 } elseif ($year_date > 0 && !empty($day_date)) {
378 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month_date, $day_date, $year_date, $gm));
379 $sqldate .=
"' AND '".$db->idate(
dol_mktime(23, 59, 59, $month_date, $day_date, $year_date, $gm)).
"'";
382 $sqldate .= ($excludefirstand ?
"" :
" AND ").
" date_format( ".$datefield.
", '%c') = '".$db->escape($month_date).
"'";
384 } elseif ($year_date > 0) {
385 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_get_first_day($year_date, 1, $gm));
386 $sqldate .=
"' AND '".$db->idate(
dol_get_last_day($year_date, 12, $gm)).
"'";
414 if (preg_match(
'/^([0-9]+)\/([0-9]+)\/([0-9]+)\s?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $string, $reg)) {
415 dol_syslog(
"dol_stringtotime call to function with deprecated parameter format", LOG_WARNING);
427 if ($syear >= 50 && $syear < 100) {
430 $string = sprintf(
"%04d%02d%02d%02d%02d%02d", $syear, $smonth, $sday, $shour, $smin, $ssec);
431 } 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)
432 || preg_match(
'/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/i', $string, $reg)
433 || 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)
441 $string = sprintf(
"%04d%02d%02d%02d%02d%02d", $syear, $smonth, $sday, $shour, $smin, $ssec);
444 $string = preg_replace(
'/([^0-9])/i',
'', $string);
445 $tmp = $string.
'000000';
449 } elseif (empty($gm) || $gm ===
'tzserver') {
453 $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);
468 $time =
dol_mktime(12, 0, 0, $month, $day, $year, 1, 0);
469 $time -= 24 * 60 * 60;
471 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
484 $time =
dol_mktime(12, 0, 0, $month, $day, $year, 1, 0);
485 $time += 24 * 60 * 60;
487 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
501 $prev_year = $year - 1;
503 $prev_month = $month - 1;
506 return array(
'year' => $prev_year,
'month' => $prev_month);
520 $next_year = $year + 1;
522 $next_month = $month + 1;
525 return array(
'year' => $next_year,
'month' => $next_month);
541 $time =
dol_mktime(12, 0, 0, $month, $tmparray[
'first_day'], $year, 1, 0);
542 $time -= 24 * 60 * 60 * 7;
544 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
560 $time =
dol_mktime(12, 0, 0, $tmparray[
'first_month'], $tmparray[
'first_day'], $tmparray[
'first_year'], 1, 0);
561 $time += 24 * 60 * 60 * 7;
564 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
583 return dol_mktime(0, 0, 0, $month, 1, $year, $gm);
610 $datelim =
dol_mktime(23, 59, 59, $month, 1, $year, $gm);
611 $datelim -= (3600 * 24);
626 $tmparray =
dol_getdate($date,
false, ($gm ==
'gmt' ?
'gmt' :
''));
627 return dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year'], $gm);
640 $tmparray =
dol_getdate($date,
false, ($gm ==
'gmt' ?
'gmt' :
''));
641 return dol_mktime(0, 0, 0, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year'], $gm);
658 $date =
dol_mktime(0, 0, 0, $month, $day, $year, $gm);
661 $start_week = (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1);
666 $days = $start_week - $tmparray[
'wday'];
671 $seconds = $days * 24 * 60 * 60;
675 $tmpdaytms = date($tmparray[0]) - $seconds;
676 $tmpday = date(
"d", $tmpdaytms);
679 if ($tmpday > $day) {
680 $prev_month = $month - 1;
683 if ($prev_month == 0) {
685 $prev_year = $year - 1;
688 $prev_month = $month;
691 $tmpmonth = $prev_month;
692 $tmpyear = $prev_year;
695 $tmptime =
dol_mktime(12, 0, 0, $month, $tmpday, $year, 1, 0);
696 $tmptime -= 24 * 60 * 60 * 7;
698 $prev_day = $tmparray[
'mday'];
701 if ($prev_day > $tmpday) {
702 $prev_month = $month - 1;
705 if ($prev_month == 0) {
707 $prev_year = $year - 1;
711 $week = date(
"W",
dol_mktime(0, 0, 0, $tmpmonth, $tmpday, $tmpyear, $gm));
713 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);
725 $base =
new DateTime(
"$year-03-21",
new DateTimeZone(
"UTC"));
726 $days = easter_days($year);
727 $tmp = $base->add(
new DateInterval(
"P{$days}D"));
728 return $tmp->getTimestamp();
747function num_public_holiday($timestampStart, $timestampEnd, $country_code =
'', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1, $includemonday = -1)
749 global $db, $conf, $mysoc;
754 if ((($timestampEnd - $timestampStart) % 86400) != 0) {
755 return 'Error Dates must use same hours and must be GMT dates';
758 if (empty($country_code)) {
759 $country_code = $mysoc->country_code;
761 if ($includemonday < 0) {
762 $includemonday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY : 0);
764 if ($includefriday < 0) {
765 $includefriday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY : 0);
767 if ($includesaturday < 0) {
768 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
770 if ($includesunday < 0) {
771 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
774 $country_id =
dol_getIdFromCode($db, $country_code,
'c_country',
'code',
'rowid');
777 while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd))
780 $specialdayrule = array();
782 $jour = gmdate(
"d", $timestampStart);
783 $mois = gmdate(
"m", $timestampStart);
784 $annee = gmdate(
"Y", $timestampStart);
790 $sql =
"SELECT code, entity, fk_country, dayrule, year, month, day, active";
791 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_hrm_public_holiday";
792 $sql .=
" WHERE active = 1 and fk_country IN (0".($country_id > 0 ?
", ".$country_id : 0).
")";
793 $sql .=
" AND entity IN (0," .getEntity(
'holiday') .
")";
795 $resql = $db->query($sql);
797 $num_rows = $db->num_rows($resql);
799 while ($i < $num_rows) {
800 $obj = $db->fetch_object($resql);
802 if (!empty($obj->dayrule) && $obj->dayrule !=
'date') {
803 $specialdayrule[$obj->dayrule] = $obj->dayrule;
806 if (!empty($obj->year) && $obj->year != $annee) {
809 if ($obj->month != $mois) {
812 if ($obj->day != $jour) {
825 return 'Error sql '.$db->lasterror();
832 if (in_array(
'easter', $specialdayrule)) {
835 $jour_paques = gmdate(
"d", $date_paques);
836 $mois_paques = gmdate(
"m", $date_paques);
837 if ($jour_paques == $jour && $mois_paques == $mois) {
843 if (in_array(
'eastermonday', $specialdayrule)) {
847 $date_lundi_paques = $date_paques + (3600 * 24);
848 $jour_lundi_paques = gmdate(
"d", $date_lundi_paques);
849 $mois_lundi_paques = gmdate(
"m", $date_lundi_paques);
850 if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) {
858 if (in_array(
'goodfriday', $specialdayrule)) {
863 $date_good_friday = $easter - (2 * 3600 * 24);
864 $dom_good_friday = gmdate(
"d", $date_good_friday);
865 $month_good_friday = gmdate(
"m", $date_good_friday);
867 if ($dom_good_friday == $jour && $month_good_friday == $mois) {
872 if (in_array(
'ascension', $specialdayrule)) {
875 $date_ascension = $date_paques + (3600 * 24 * 39);
876 $jour_ascension = gmdate(
"d", $date_ascension);
877 $mois_ascension = gmdate(
"m", $date_ascension);
878 if ($jour_ascension == $jour && $mois_ascension == $mois) {
884 if (in_array(
'pentecote', $specialdayrule)) {
887 $date_pentecote = $date_paques + (3600 * 24 * 49);
888 $jour_pentecote = gmdate(
"d", $date_pentecote);
889 $mois_pentecote = gmdate(
"m", $date_pentecote);
890 if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
895 if (in_array(
'pentecotemonday', $specialdayrule)) {
898 $date_pentecote = $date_paques + (3600 * 24 * 50);
899 $jour_pentecote = gmdate(
"d", $date_pentecote);
900 $mois_pentecote = gmdate(
"m", $date_pentecote);
901 if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
907 if (in_array(
'viernessanto', $specialdayrule)) {
910 $date_viernes = $date_paques - (3600 * 24 * 2);
911 $jour_viernes = gmdate(
"d", $date_viernes);
912 $mois_viernes = gmdate(
"m", $date_viernes);
913 if ($jour_viernes == $jour && $mois_viernes == $mois) {
919 if (in_array(
'fronleichnam', $specialdayrule)) {
922 $date_fronleichnam = $date_paques + (3600 * 24 * 60);
923 $jour_fronleichnam = gmdate(
"d", $date_fronleichnam);
924 $mois_fronleichnam = gmdate(
"m", $date_fronleichnam);
925 if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) {
931 if (in_array(
'genevafast', $specialdayrule)) {
933 $date_1sunsept = strtotime(
'next thursday', strtotime(
'next sunday', mktime(0, 0, 0, 9, 1, $annee)));
934 $jour_1sunsept = date(
"d", $date_1sunsept);
935 $mois_1sunsept = date(
"m", $date_1sunsept);
936 if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) $ferie=
true;
944 if ($includefriday || $includesaturday || $includesunday) {
945 $jour_julien = unixtojd($timestampStart);
946 $jour_semaine = jddayofweek($jour_julien, 0);
947 if ($includefriday) {
948 if ($jour_semaine == 5) {
952 if ($includesaturday) {
953 if ($jour_semaine == 6) {
957 if ($includesunday) {
958 if ($jour_semaine == 0) {
994 if ($timestampStart < $timestampEnd) {
1000 $nbjours = (int) floor(($timestampEnd - $timestampStart) / (60 * 60 * 24)) + 1 - $bit;
1018function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, $halfday = 0, $country_code =
'')
1020 global $langs, $mysoc;
1022 if (empty($country_code)) {
1023 $country_code = $mysoc->country_code;
1026 dol_syslog(
'num_open_day timestampStart='.$timestampStart.
' timestampEnd='.$timestampEnd.
' bit='.$lastday.
' country_code='.$country_code);
1029 if (!is_int($timestampStart) && !is_float($timestampStart)) {
1030 return 'ErrorBadParameter_num_open_day';
1032 if (!is_int($timestampEnd) && !is_float($timestampEnd)) {
1033 return 'ErrorBadParameter_num_open_day';
1037 if ($timestampStart < $timestampEnd) {
1040 $numholidays =
num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
1041 $nbOpenDay = ($numdays - $numholidays);
1042 if ($inhour == 1 && $nbOpenDay <= 3) {
1043 $nbOpenDay = ($nbOpenDay * 24);
1045 return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
1046 } elseif ($timestampStart == $timestampEnd) {
1049 $numholidays =
num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
1050 if ($numholidays == 1) {
1055 $nbOpenDay = $lastday;
1058 $nbOpenDay = ($nbOpenDay * 24);
1060 return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
1062 return $langs->trans(
"Error");
1078 $montharray = array(
1079 1 => $outputlangs->trans(
"Month01"),
1080 2 => $outputlangs->trans(
"Month02"),
1081 3 => $outputlangs->trans(
"Month03"),
1082 4 => $outputlangs->trans(
"Month04"),
1083 5 => $outputlangs->trans(
"Month05"),
1084 6 => $outputlangs->trans(
"Month06"),
1085 7 => $outputlangs->trans(
"Month07"),
1086 8 => $outputlangs->trans(
"Month08"),
1087 9 => $outputlangs->trans(
"Month09"),
1088 10 => $outputlangs->trans(
"Month10"),
1089 11 => $outputlangs->trans(
"Month11"),
1090 12 => $outputlangs->trans(
"Month12")
1093 if (!empty($short)) {
1094 $montharray = array(
1095 1 => $outputlangs->trans(
"MonthShort01"),
1096 2 => $outputlangs->trans(
"MonthShort02"),
1097 3 => $outputlangs->trans(
"MonthShort03"),
1098 4 => $outputlangs->trans(
"MonthShort04"),
1099 5 => $outputlangs->trans(
"MonthShort05"),
1100 6 => $outputlangs->trans(
"MonthShort06"),
1101 7 => $outputlangs->trans(
"MonthShort07"),
1102 8 => $outputlangs->trans(
"MonthShort08"),
1103 9 => $outputlangs->trans(
"MonthShort09"),
1104 10 => $outputlangs->trans(
"MonthShort10"),
1105 11 => $outputlangs->trans(
"MonthShort11"),
1106 12 => $outputlangs->trans(
"MonthShort12")
1121 $nb_days = cal_days_in_month(CAL_GREGORIAN, $month, $year);
1123 for ($day = 1; $day < $nb_days; $day++) {
1125 $TWeek[$week_number] = $week_number;
1138 $TFirstDayOfWeek = array();
1139 foreach ($TWeek as $weekNb) {
1140 if (in_array(
'01', $TWeek) && in_array(
'52', $TWeek) && $weekNb ==
'01') {
1143 $TFirstDayOfWeek[$weekNb] = date(
'd', strtotime($year.
'W'.$weekNb));
1145 return $TFirstDayOfWeek;
1156 $TLastDayOfWeek = array();
1157 foreach ($TWeek as $weekNb) {
1158 $TLastDayOfWeek[$weekNb] = date(
'd', strtotime($year.
'W'.$weekNb.
'+6 days'));
1160 return $TLastDayOfWeek;
1172 $date =
new DateTime($year.
'-'.$month.
'-'.$day);
1173 $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 informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
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.