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));
128 if (empty($duration_value)) {
131 if ($duration_unit ==
's') {
132 return $time + ($duration_value);
134 if ($duration_unit ==
'i') {
135 return $time + (60 * $duration_value);
137 if ($duration_unit ==
'h') {
138 return $time + (3600 * $duration_value);
140 if ($duration_unit ==
'w') {
141 return $time + (3600 * 24 * 7 * $duration_value);
146 if ($duration_value > 0) {
147 $deltastring .= abs($duration_value);
150 if ($duration_value < 0) {
151 $deltastring .= abs($duration_value);
154 if ($duration_unit ==
'd') {
157 if ($duration_unit ==
'm') {
160 if ($duration_unit ==
'y') {
164 $date =
new DateTime();
166 $date->setTimezone(
new DateTimeZone(
'UTC'));
168 $date->setTimestamp($time);
169 $interval =
new DateInterval($deltastring);
172 $date->sub($interval);
174 $date->add($interval);
177 if ($ruleforendofmonth == 1 && $duration_unit ==
'm') {
180 $timetotalmonths = (($timeyear * 12) + $timemonth);
182 $monthsexpected = ($timetotalmonths + $duration_value);
184 $newtime = $date->getTimestamp();
188 $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth);
190 if ($monthsexpected < $newtimetotalmonths) {
195 $datelim =
dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear);
196 $datelim -= (3600 * 24);
198 $date->setTimestamp($datelim);
201 return $date->getTimestamp();
216 $iResult = ((int) $iHours * 3600) + ((int) $iMinutes * 60) + (int) $iSeconds;
247 if (empty($lengthOfDay)) {
248 $lengthOfDay = 86400;
250 if (empty($lengthOfWeek)) {
253 $nbHbyDay = $lengthOfDay / 3600;
255 if ($format ==
'all' || $format ==
'allwithouthour' || $format ==
'allhour' || $format ==
'allhourmin' || $format ==
'allhourminsec') {
256 if ((
int) $iSecond === 0) {
264 if ($iSecond >= $lengthOfDay) {
265 for ($i = $iSecond; $i >= $lengthOfDay; $i -= $lengthOfDay) {
267 $iSecond -= $lengthOfDay;
269 $dayTranslate = $langs->trans(
"Day");
270 if ($iSecond >= ($lengthOfDay * 2)) {
271 $dayTranslate = $langs->trans(
"Days");
275 if ($lengthOfWeek < 7) {
277 if ($sDay >= $lengthOfWeek) {
278 $sWeek = (int) (($sDay - $sDay % $lengthOfWeek) / $lengthOfWeek);
279 $sDay = $sDay % $lengthOfWeek;
280 $weekTranslate = $langs->trans(
"DurationWeek");
282 $weekTranslate = $langs->trans(
"DurationWeeks");
284 $sTime .= $sWeek.
' '.$weekTranslate.
' ';
289 $dayTranslate = $langs->trans(
"Day");
291 $dayTranslate = $langs->trans(
"Days");
293 $sTime .= $sDay.
' '.$langs->trans(
"d").
' ';
296 if ($format ==
'all') {
297 if ($iSecond || empty($sDay)) {
300 } elseif ($format ==
'allhourminsec') {
301 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond/3600))).
':'.sprintf(
"%02d", ((
int) floor(($iSecond % 3600) / 60))).
':'.sprintf(
"%02d", ((
int) ($iSecond % 60)));
302 } elseif ($format ==
'allhourmin') {
303 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond/3600))).
':'.sprintf(
"%02d", ((
int) floor(($iSecond % 3600)/60)));
304 } elseif ($format ==
'allhour') {
305 return sprintf(
"%02d", ($sWeek * $lengthOfWeek * $nbHbyDay + $sDay * $nbHbyDay + (
int) floor($iSecond/3600)));
307 } elseif ($format ==
'hour') {
309 } elseif ($format ==
'fullhour') {
310 if (!empty($iSecond)) {
311 $iSecond = $iSecond / 3600;
316 } elseif ($format ==
'min') {
318 } elseif ($format ==
'sec') {
320 } elseif ($format ==
'month') {
322 } elseif ($format ==
'year') {
339 if ($duration_unit ==
's') {
340 $result = $duration_value / 3600;
342 if ($duration_unit ==
'i') {
343 $result = $duration_value / 60;
345 if ($duration_unit ==
'h') {
346 $result = $duration_value;
348 if ($duration_unit ==
'd') {
349 $result = $duration_value * 24;
351 if ($duration_unit ==
'w') {
352 $result = $duration_value * 24 * 7;
354 if ($duration_unit ==
'm') {
355 $result = $duration_value * 730.484;
357 if ($duration_unit ==
'y') {
358 $result = $duration_value * 365 * 24;
377function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand = 0, $gm =
false)
382 $day_date = intval($day_date);
383 $month_date = intval($month_date);
384 $year_date = intval($year_date);
386 if ($month_date > 0) {
387 if ($month_date > 12) {
390 if ($year_date > 0 && empty($day_date)) {
391 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_get_first_day($year_date, $month_date, $gm));
392 $sqldate .=
"' AND '".$db->idate(
dol_get_last_day($year_date, $month_date, $gm)).
"'";
393 } elseif ($year_date > 0 && !empty($day_date)) {
394 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_mktime(0, 0, 0, $month_date, $day_date, $year_date, $gm));
395 $sqldate .=
"' AND '".$db->idate(
dol_mktime(23, 59, 59, $month_date, $day_date, $year_date, $gm)).
"'";
398 $sqldate .= ($excludefirstand ?
"" :
" AND ").
" date_format( ".$datefield.
", '%c') = '".$db->escape($month_date).
"'";
400 } elseif ($year_date > 0) {
401 $sqldate .= ($excludefirstand ?
"" :
" AND ").$datefield.
" BETWEEN '".$db->idate(
dol_get_first_day($year_date, 1, $gm));
402 $sqldate .=
"' AND '".$db->idate(
dol_get_last_day($year_date, 12, $gm)).
"'";
430 if (preg_match(
'/^([0-9]+)\/([0-9]+)\/([0-9]+)\s?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $string, $reg)) {
431 dol_syslog(
"dol_stringtotime call to function with deprecated parameter format", LOG_WARNING);
443 if ($syear >= 50 && $syear < 100) {
446 $string = sprintf(
"%04d%02d%02d%02d%02d%02d", $syear, $smonth, $sday, $shour, $smin, $ssec);
447 } 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)
448 || preg_match(
'/^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$/i', $string, $reg)
449 || 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)
457 $string = sprintf(
"%04d%02d%02d%02d%02d%02d", $syear, $smonth, $sday, $shour, $smin, $ssec);
460 $string = preg_replace(
'/([^0-9])/i',
'', $string);
461 $tmp = $string.
'000000';
465 } elseif (empty($gm) || $gm ===
'tzserver') {
469 $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);
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']);
500 $time =
dol_mktime(12, 0, 0, $month, $day, $year, 1, 0);
501 $time += 24 * 60 * 60;
503 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
517 $prev_year = $year - 1;
519 $prev_month = $month - 1;
522 return array(
'year' => $prev_year,
'month' => $prev_month);
536 $next_year = $year + 1;
538 $next_month = $month + 1;
541 return array(
'year' => $next_year,
'month' => $next_month);
557 $time =
dol_mktime(12, 0, 0, $month, $tmparray[
'first_day'], $year, 1, 0);
558 $time -= 24 * 60 * 60 * 7;
560 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
576 $time =
dol_mktime(12, 0, 0, $tmparray[
'first_month'], $tmparray[
'first_day'], $tmparray[
'first_year'], 1, 0);
577 $time += 24 * 60 * 60 * 7;
580 return array(
'year' => $tmparray[
'year'],
'month' => $tmparray[
'mon'],
'day' => $tmparray[
'mday']);
599 return dol_mktime(0, 0, 0, $month, 1, $year, $gm);
626 $datelim =
dol_mktime(23, 59, 59, $month, 1, $year, $gm);
627 $datelim -= (3600 * 24);
642 $tmparray =
dol_getdate($date,
false, ($gm ==
'gmt' ?
'gmt' :
''));
643 return dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year'], $gm);
656 $tmparray =
dol_getdate($date,
false, ($gm ==
'gmt' ?
'gmt' :
''));
657 return dol_mktime(0, 0, 0, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year'], $gm);
674 $date =
dol_mktime(0, 0, 0, $month, $day, $year, $gm);
677 $start_week = (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1);
682 $days = $start_week - $tmparray[
'wday'];
687 $seconds = $days * 24 * 60 * 60;
691 $tmpdaytms = date($tmparray[0]) - $seconds;
692 $tmpday = date(
"d", $tmpdaytms);
695 if ($tmpday > $day) {
696 $prev_month = $month - 1;
699 if ($prev_month == 0) {
701 $prev_year = $year - 1;
704 $prev_month = $month;
707 $tmpmonth = $prev_month;
708 $tmpyear = $prev_year;
711 $tmptime =
dol_mktime(12, 0, 0, $month, $tmpday, $year, 1, 0);
712 $tmptime -= 24 * 60 * 60 * 7;
714 $prev_day = $tmparray[
'mday'];
717 if ($prev_day > $tmpday) {
718 $prev_month = $month - 1;
721 if ($prev_month == 0) {
723 $prev_year = $year - 1;
727 $week = date(
"W",
dol_mktime(0, 0, 0, $tmpmonth, $tmpday, $tmpyear, $gm));
729 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);
741 $base =
new DateTime(
"$year-03-21",
new DateTimeZone(
"UTC"));
742 $days = easter_days($year);
743 $tmp = $base->add(
new DateInterval(
"P{$days}D"));
744 return $tmp->getTimestamp();
763function num_public_holiday($timestampStart, $timestampEnd, $country_code =
'', $lastday = 0, $includesaturday = -1, $includesunday = -1, $includefriday = -1, $includemonday = -1)
765 global $db, $conf, $mysoc;
770 if (($timestampEnd - $timestampStart) % 86400 != 0) {
771 return 'Error Dates must use same hours and must be GMT dates';
774 if (empty($country_code)) {
775 $country_code = $mysoc->country_code;
777 if ($includemonday < 0) {
778 $includemonday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY : 0);
780 if ($includefriday < 0) {
781 $includefriday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY : 0);
783 if ($includesaturday < 0) {
784 $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
786 if ($includesunday < 0) {
787 $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
790 $country_id =
dol_getIdFromCode($db, $country_code,
'c_country',
'code',
'rowid');
793 while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd))
796 $specialdayrule = array();
798 $jour = gmdate(
"d", $timestampStart);
799 $mois = gmdate(
"m", $timestampStart);
800 $annee = gmdate(
"Y", $timestampStart);
806 $sql =
"SELECT code, entity, fk_country, dayrule, year, month, day, active";
807 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_hrm_public_holiday";
808 $sql .=
" WHERE active = 1 and fk_country IN (0".($country_id > 0 ?
", ".$country_id : 0).
")";
809 $sql .=
" AND entity IN (0," .getEntity(
'holiday') .
")";
811 $resql = $db->query($sql);
813 $num_rows = $db->num_rows($resql);
815 while ($i < $num_rows) {
816 $obj = $db->fetch_object($resql);
818 if (!empty($obj->dayrule) && $obj->dayrule !=
'date') {
819 $specialdayrule[$obj->dayrule] = $obj->dayrule;
822 if (!empty($obj->year) && $obj->year != $annee) {
825 if ($obj->month != $mois) {
828 if ($obj->day != $jour) {
841 return 'Error sql '.$db->lasterror();
848 if (in_array(
'easter', $specialdayrule)) {
851 $jour_paques = gmdate(
"d", $date_paques);
852 $mois_paques = gmdate(
"m", $date_paques);
853 if ($jour_paques == $jour && $mois_paques == $mois) {
859 if (in_array(
'eastermonday', $specialdayrule)) {
863 $date_lundi_paques = $date_paques + (3600 * 24);
864 $jour_lundi_paques = gmdate(
"d", $date_lundi_paques);
865 $mois_lundi_paques = gmdate(
"m", $date_lundi_paques);
866 if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) {
874 if (in_array(
'goodfriday', $specialdayrule)) {
879 $date_good_friday = $easter - (2 * 3600 * 24);
880 $dom_good_friday = gmdate(
"d", $date_good_friday);
881 $month_good_friday = gmdate(
"m", $date_good_friday);
883 if ($dom_good_friday == $jour && $month_good_friday == $mois) {
888 if (in_array(
'ascension', $specialdayrule)) {
891 $date_ascension = $date_paques + (3600 * 24 * 39);
892 $jour_ascension = gmdate(
"d", $date_ascension);
893 $mois_ascension = gmdate(
"m", $date_ascension);
894 if ($jour_ascension == $jour && $mois_ascension == $mois) {
900 if (in_array(
'pentecost', $specialdayrule)) {
903 $date_pentecote = $date_paques + (3600 * 24 * 49);
904 $jour_pentecote = gmdate(
"d", $date_pentecote);
905 $mois_pentecote = gmdate(
"m", $date_pentecote);
906 if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
911 if (in_array(
'pentecotemonday', $specialdayrule)) {
914 $date_pentecote = $date_paques + (3600 * 24 * 50);
915 $jour_pentecote = gmdate(
"d", $date_pentecote);
916 $mois_pentecote = gmdate(
"m", $date_pentecote);
917 if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
923 if (in_array(
'viernessanto', $specialdayrule)) {
926 $date_viernes = $date_paques - (3600 * 24 * 2);
927 $jour_viernes = gmdate(
"d", $date_viernes);
928 $mois_viernes = gmdate(
"m", $date_viernes);
929 if ($jour_viernes == $jour && $mois_viernes == $mois) {
935 if (in_array(
'fronleichnam', $specialdayrule)) {
938 $date_fronleichnam = $date_paques + (3600 * 24 * 60);
939 $jour_fronleichnam = gmdate(
"d", $date_fronleichnam);
940 $mois_fronleichnam = gmdate(
"m", $date_fronleichnam);
941 if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) {
947 if (in_array(
'genevafast', $specialdayrule)) {
949 $date_1sunsept = strtotime(
'next thursday', strtotime(
'next sunday', mktime(0, 0, 0, 9, 1, $annee)));
950 $jour_1sunsept = date(
"d", $date_1sunsept);
951 $mois_1sunsept = date(
"m", $date_1sunsept);
952 if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) {
962 if ($includefriday || $includesaturday || $includesunday) {
963 $jour_julien = unixtojd($timestampStart);
964 $jour_semaine = jddayofweek($jour_julien, 0);
965 if ($includefriday) {
966 if ($jour_semaine == 5) {
970 if ($includesaturday) {
971 if ($jour_semaine == 6) {
975 if ($includesunday) {
976 if ($jour_semaine == 0) {
1012 if ($timestampStart < $timestampEnd) {
1013 if ($lastday == 1) {
1018 $nbjours = (int) floor(($timestampEnd - $timestampStart) / (60 * 60 * 24)) + 1 - $bit;
1036function num_open_day($timestampStart, $timestampEnd, $inhour = 0, $lastday = 0, $halfday = 0, $country_code =
'')
1038 global $langs, $mysoc;
1040 if (empty($country_code)) {
1041 $country_code = $mysoc->country_code;
1044 dol_syslog(
'num_open_day timestampStart='.$timestampStart.
' timestampEnd='.$timestampEnd.
' bit='.$lastday.
' country_code='.$country_code);
1047 if (!is_int($timestampStart) && !is_float($timestampStart)) {
1048 return 'ErrorBadParameter_num_open_day';
1050 if (!is_int($timestampEnd) && !is_float($timestampEnd)) {
1051 return 'ErrorBadParameter_num_open_day';
1055 if ($timestampStart < $timestampEnd) {
1058 $numholidays =
num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
1059 $nbOpenDay = ($numdays - $numholidays);
1060 if ($inhour == 1 && $nbOpenDay <= 3) {
1061 $nbOpenDay = ($nbOpenDay * 24);
1063 return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
1064 } elseif ($timestampStart == $timestampEnd) {
1067 $numholidays =
num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday);
1068 if ($numholidays == 1) {
1073 $nbOpenDay = $lastday;
1076 $nbOpenDay = ($nbOpenDay * 24);
1078 return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday));
1080 return $langs->trans(
"Error");
1096 $montharray = array(
1097 1 => $outputlangs->trans(
"Month01"),
1098 2 => $outputlangs->trans(
"Month02"),
1099 3 => $outputlangs->trans(
"Month03"),
1100 4 => $outputlangs->trans(
"Month04"),
1101 5 => $outputlangs->trans(
"Month05"),
1102 6 => $outputlangs->trans(
"Month06"),
1103 7 => $outputlangs->trans(
"Month07"),
1104 8 => $outputlangs->trans(
"Month08"),
1105 9 => $outputlangs->trans(
"Month09"),
1106 10 => $outputlangs->trans(
"Month10"),
1107 11 => $outputlangs->trans(
"Month11"),
1108 12 => $outputlangs->trans(
"Month12")
1111 if (!empty($short)) {
1112 $montharray = array(
1113 1 => $outputlangs->trans(
"MonthShort01"),
1114 2 => $outputlangs->trans(
"MonthShort02"),
1115 3 => $outputlangs->trans(
"MonthShort03"),
1116 4 => $outputlangs->trans(
"MonthShort04"),
1117 5 => $outputlangs->trans(
"MonthShort05"),
1118 6 => $outputlangs->trans(
"MonthShort06"),
1119 7 => $outputlangs->trans(
"MonthShort07"),
1120 8 => $outputlangs->trans(
"MonthShort08"),
1121 9 => $outputlangs->trans(
"MonthShort09"),
1122 10 => $outputlangs->trans(
"MonthShort10"),
1123 11 => $outputlangs->trans(
"MonthShort11"),
1124 12 => $outputlangs->trans(
"MonthShort12")
1139 $nb_days = cal_days_in_month(CAL_GREGORIAN, $month, $year);
1141 for ($day = 1; $day < $nb_days; $day++) {
1143 $TWeek[$week_number] = $week_number;
1156 $TFirstDayOfWeek = array();
1157 foreach ($TWeek as $weekNb) {
1158 if (in_array(
'01', $TWeek) && in_array(
'52', $TWeek) && $weekNb ==
'01') {
1161 $TFirstDayOfWeek[$weekNb] = date(
'd', strtotime($year.
'W'.$weekNb));
1163 return $TFirstDayOfWeek;
1174 $TLastDayOfWeek = array();
1175 foreach ($TWeek as $weekNb) {
1176 $TLastDayOfWeek[$weekNb] = date(
'd', strtotime($year.
'W'.$weekNb.
'+6 days'));
1178 return $TLastDayOfWeek;
1190 $date =
new DateTime($year.
'-'.$month.
'-'.$day);
1191 $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.
getDolGlobalString($key, $default='')
Return 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.