33 $datum = sprintf(
"%02d.%02d.%04d", $date[
"mday"],$date[
"mon"],$date[
"year"]);
48 $date=
""; $y=
""; $m=
"";
$d=
"";
50 if (ereg(
"([0-9]{1,2}).([0-9]{1,2}).([0-9]{2,4})",$AInputDate,$p))
57 if ((
$d>0 &&
$d<32) && ($m>0 && $m<13) && (strlen($y)!=3))
59 if (strlen(
$d) == 1)
$d =
"0".$d;
60 if (strlen($m) == 1) $m =
"0".$m;
64 if ($y>=70) $y = $y + 1900;
65 if ($y<70) $y = $y + 2000;
69 checkdate($m,
$d, $y);
74 $uhrzeit = substr($AInputDate, -8);
77 if (ereg(
"([0-9]{2}):([0-9]{2}):([0-9]{2})",$AInputDate,$p))
83 if (($h>-1 && $h<24) && ($min>-1 && $min<60) && ($s>-1 && $s<60))
86 $date = sprintf(
"%04d-%02d-%02d %02d:%02d:%02d",$y,$m,
$d,$h,$min,$s);
93 $date = sprintf(
"%04d-%02d-%02d %02d:%02d:%02d",$y,$m,
$d,$zeit[
"hours"],$zeit[
"minutes"],$zeit[
"seconds"]);
110 substr($ADatumSQL, 5, 2).
111 substr($ADatumSQL, 8, 2).
112 substr($ADatumSQL, 11, 2).
113 substr($ADatumSQL, 14, 2).
114 substr($ADatumSQL, 17, 2);
126 substr($ADatum, 3, 2).
127 substr($ADatum, 0, 2).
128 substr($ADatum, 11, 2).
129 substr($ADatum, 14, 2).
130 substr($ADatum, 17, 2);
142 return sprintf(
"%02d.%02d.%04d",substr(
$t, 8, 2),substr(
$t, 5, 2),substr(
$t, 0, 4));
152 return sprintf(
"%02d.%02d.%04d",substr(
$t, 6, 2),substr(
$t, 4, 2),substr(
$t, 0, 4));
162 return sprintf(
"%02d.%02d.%04d %02d:%02d:%02d",substr(
$t, 6, 2),substr(
$t, 4, 2),substr(
$t, 0, 4),substr(
$t, 8, 2),substr(
$t, 10, 2),substr(
$t, 12, 2));
172 return sprintf(
"%04d-%02d-%02d",substr(
$t, 0, 4),substr(
$t, 4, 2),substr(
$t, 6, 2));
184 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $aTimestamp, $matches))
186 $date =
"$matches[1]-$matches[2]-$matches[3] $matches[4]:$matches[5]:$matches[6]";
201 if ($ADate1 > $ADate2)
216 return doubleval(ereg_replace (
",",
".",$var));
225 $num_args = func_num_args();
227 $geld = func_get_arg(0);
231 $test = intval($geld);
237 return number_format($geld,2,
",",
".").
" €";
247 $num_args = func_num_args();
249 $prozent = func_get_arg(0);
253 $test = intval($prozent);
259 return number_format($prozent,2,
",",
".").
"%";
268 return round($value * 100) / 100;
288 public static function fmtDateTime($a_str,$a_dateformat,$a_timeformat,$a_mode =
"datetime", $a_relative = TRUE)
291 if ($a_dateformat ==
"")
293 $a_dateformat =
"Y-m-d";
297 if ($a_timeformat ==
"")
299 $a_timeformat =
"H:i:s";
303 if ($a_str ==
'0000-00-00 00:00:00')
306 return $lng->txt(
'no_date');
310 $d = substr($a_str,8,2);
311 $m = substr($a_str,5,2);
312 $y = substr($a_str,0,4);
313 $h = substr($a_str,11,2);
314 $i = substr($a_str,14,2);
315 $s = substr($a_str,17,4);
319 ($y == 1970 and ($m < 1 or
$d < 1)))
327 if ($a_mode ==
"time")
329 return date($a_timeformat,mktime($h,$i,$s,1,1,1999));
335 $minuteswest = gettimeofday(
false);
336 $minuteswest = $minuteswest[
'minuteswest'];
337 $today = $now - $now % (24 * 60 * 60) + $minuteswest * 60;
345 $date = ($isToday) ? $lng->txt(
'today') :
346 (($isYesterday) ? $lng->txt(
'yesterday') :
347 (($isTomorrow) ? $lng->txt(
'tomorrow') :
348 date($a_dateformat,mktime($h,$i,$s,$m,
$d,$y))))
353 $date = date($a_dateformat,mktime($h,$i,$s,$m,
$d,$y));
356 return ($a_mode ==
"date") ? $date : $date.
' '.date($a_timeformat,mktime($h,$i,$s,$m,
$d,$y));
373 function fmtFloat($a_float, $a_decimals=0, $a_dec_point = null, $a_thousands_sep = null, $a_suppress_dot_zero=
false)
378 if ($a_dec_point == null)
380 $a_dec_point = $lng->txt(
'lang_sep_decimal');
385 if ($a_dec_point ==
'-lang_sep_decimal-')
390 if ($a_thousands_sep == null)
392 $a_thousands_sep = $lng->txt(
'lang_sep_thousand');
397 if ($a_thousands_sep ==
'-lang_sep_thousand-')
399 $a_thousands_sep =
",";
402 $txt = number_format($a_float, $a_decimals, $a_dec_point, $a_thousands_sep);
405 if (($a_suppress_dot_zero == 0 || $a_decimal == 0) &&
406 substr($txt,-2) == $a_dec_point.
'0')
408 $txt = substr($txt, 0, strlen($txt) - 2);
410 if ($a_float == 0 and $txt ==
"")
419 if (strlen($a_unix_timestamp) == 0)
421 return strftime(
"%Y-%m-%d %H:%M:%S");
425 return strftime(
"%Y-%m-%d %H:%M:%S", $a_unix_timestamp);
440 function formatDate($a_date,$a_mode =
"datetime", $a_omit_seconds =
false, $a_relative = TRUE)
445 if ($a_date ==
"0000-00-00 00:00:00")
447 return $lng->txt(
"no_date");
450 $dateformat = $lng->txt(
"lang_dateformat");
451 if ($a_omit_seconds && ($lng->txt(
"lang_timeformat_no_sec") !=
"-lang_timeformat_no_sec-"))
453 $timeformat = $lng->txt(
"lang_timeformat_no_sec");
457 $timeformat = $lng->txt(
"lang_timeformat");
460 if ($dateformat ==
"-lang_dateformat-")
465 if ($timeformat ==
"-lang_timeformat-")
477 $format = $lng->txt(
'lang_dateformat');
481 $format .= (
' '.$lng->txt(
'lang_timeformat_no_sec'));
483 return date($format,$ut);
495 $r = $a_ts2 - $a_ts1;
497 $dd = floor($r/86400);
504 $hh = floor($r/3600);
522 return $hh.
":".$mm.
":".$ss;
533 $arrDT = explode(
" ", $a_datetime);
534 $arrD = explode(
"-", $arrDT[0]);
535 $arrT = explode(
":", $arrDT[1]);
537 return mktime($arrT[0], $arrT[1], $arrT[2], $arrD[1], $arrD[2], $arrD[0]);
558 $seconds = $seconds ? $seconds : 0;
563 $days = floor($seconds / 86400);
564 $rest = $seconds % 86400;
566 $hours = floor(
$rest / 3600);
569 $minutes = floor(
$rest / 60);
570 $seconds =
$rest % 60;
574 $days = ceil($seconds / 86400);
575 $rest = $seconds % 86400;
577 $hours = ceil(
$rest / 3600);
580 $minutes = ceil(
$rest / 60);
581 $seconds =
$rest % 60;
586 $message = $days .
' '. ($days == 1 ? $lng->txt(
'day') : $lng->txt(
'days'));
594 $message .= ($hours .
' '. ($hours == 1 ? $lng->txt(
'hour') : $lng->txt(
'hours')));
602 $message .= ($minutes .
' '. ($minutes == 1 ? $lng->txt(
'minute') : $lng->txt(
'minutes')));
604 if($force_with_seconds && $seconds)
610 $message .= ($seconds .
' '. ($seconds == 1 ? $lng->txt(
'second') : $lng->txt(
'seconds')));
612 if(!$days and !$hours and !$minutes)
614 return $seconds .
' '. ($seconds == 1 ? $lng->txt(
'second') : $lng->txt(
'seconds'));
632 $seconds = $seconds ? $seconds : 0;
636 $days = floor($seconds / 86400);
637 $rest = $seconds % 86400;
639 $hours = floor(
$rest / 3600);
642 $minutes = floor(
$rest / 60);
645 return sprintf(
"%02d:%02d:%02d:%02d",$days,$hours,$minutes,
$rest);
658 $language = $ilias->getSetting(
"language");
659 $money_locale = $language.
'_'.strtoupper($language);
664 setlocale(LC_MONETARY, $money_locale);
665 return $float_number;
692 public static function formatFloat(
$size, $a_decimals, $a_suppress_dot_zero=
false, $a_mode =
'short', $a_lng = null)
695 if ($a_lng == null) {
698 return self::fmtFloat(
$size, $a_decimals, $a_lng->txt(
'lang_sep_decimal'), $a_lng->txt(
'lang_sep_thousand', $a_suppress_dot_zero),
true).
' '.$a_lng->txt($scaled_unit);
719 if ($a_lng == null) {
729 if (
$size >= $mag * $mag * $mag)
731 $scaled_size =
$size/$mag/$mag/$mag;
732 $scaled_unit =
'lang_size_gb';
734 else if (
$size >= $mag * $mag)
736 $scaled_size =
$size/$mag/$mag;
737 $scaled_unit =
'lang_size_mb';
739 else if (
$size >= $mag)
741 $scaled_size =
$size/$mag;
742 $scaled_unit =
'lang_size_kb';
746 $scaled_size =
$size;
747 $scaled_unit =
'lang_size_bytes';
750 $result =
self::fmtFloat($scaled_size,($scaled_unit ==
'lang_size_bytes') ? 0:1, $a_lng->txt(
'lang_sep_decimal'), $a_lng->txt(
'lang_sep_thousand'),
true).
' '.$a_lng->txt($scaled_unit);
751 if ($a_mode ==
'long' &&
$size > $mag)
755 ' '.$a_lng->txt(
'lang_size_bytes').
')';