19declare(strict_types=1);
25 class_exists(
'ilDateTime');
33 public function formatDate($raw_date_input, ?
ilObjUser $user =
null, ?
int $date_format =
null): string
63 private function format($raw, ?
ilObjUser $user,
int $format,
bool $has_time): string
78 :
new ilDate($raw, $format);
109 throw new InvalidArgumentException(
'Non-numeric input given for IL_CAL_UNIX');
113 throw new InvalidArgumentException(
'Unix timestamp given but format is not IL_CAL_UNIX');
122 if (is_int($maybe_timestamp)) {
126 if (!is_string($maybe_timestamp) || !ctype_digit($maybe_timestamp)) {
131 $datetime = DateTimeImmutable::createFromFormat(
'Ymd', $maybe_timestamp);
133 }
catch (Throwable) {
formatDateTime($raw_datetime_input, ?ilObjUser $user=null, ?int $datetime_format=null)
assertFormatMatchesInput($value, int $format)
autoDetectFormat($value, int $default_when_not_unix)
formatDate($raw_date_input, ?ilObjUser $user=null, ?int $date_format=null)
isProbablyUnixTimestamp($maybe_timestamp)
format($raw, ?ilObjUser $user, int $format, bool $has_time)
static useRelativeDates()
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling