Definition at line 21 of file ilCertificateDateHelper.php.
◆ __construct()
ilCertificateDateHelper::__construct |
( |
| ) |
|
◆ assertFormatMatchesInput()
ilCertificateDateHelper::assertFormatMatchesInput |
( |
|
$value, |
|
|
int |
$format |
|
) |
| |
|
private |
- Parameters
-
- Exceptions
-
Definition at line 104 of file ilCertificateDateHelper.php.
104 : void
105 {
107
109 throw new InvalidArgumentException('Non-numeric input given for IL_CAL_UNIX');
110 }
111
113 throw new InvalidArgumentException('Unix timestamp given but format is not IL_CAL_UNIX');
114 }
115 }
isProbablyUnixTimestamp($maybe_timestamp)
References IL_CAL_UNIX, and isProbablyUnixTimestamp().
Referenced by format().
◆ autoDetectFormat()
ilCertificateDateHelper::autoDetectFormat |
( |
|
$value, |
|
|
int |
$default_when_not_unix |
|
) |
| |
|
private |
◆ format()
ilCertificateDateHelper::format |
( |
|
$raw, |
|
|
?ilObjUser |
$user, |
|
|
int |
$format, |
|
|
bool |
$has_time |
|
) |
| |
|
private |
- Parameters
-
- Exceptions
-
Definition at line 63 of file ilCertificateDateHelper.php.
63 : string
64 {
66
69 } else {
70 $raw = (string) $raw;
71 }
72
75 try {
76 $dateObj = $has_time
78 : new
ilDate($raw, $format);
79
81 $dateObj,
82 false,
83 false,
84 false,
85 $user
86 );
87 } finally {
89 }
90 }
assertFormatMatchesInput($value, int $format)
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
References assertFormatMatchesInput(), ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\int(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().
Referenced by formatDate(), and formatDateTime().
◆ formatDate()
ilCertificateDateHelper::formatDate |
( |
|
$raw_date_input, |
|
|
?ilObjUser |
$user = null , |
|
|
?int |
$date_format = null |
|
) |
| |
◆ formatDateTime()
ilCertificateDateHelper::formatDateTime |
( |
|
$raw_datetime_input, |
|
|
?ilObjUser |
$user = null , |
|
|
?int |
$datetime_format = null |
|
) |
| |
◆ isProbablyUnixTimestamp()
ilCertificateDateHelper::isProbablyUnixTimestamp |
( |
|
$maybe_timestamp | ) |
|
|
private |
- Parameters
-
int | string | $maybe_timestamp | |
Definition at line 120 of file ilCertificateDateHelper.php.
120 : bool
121 {
122 if (is_int($maybe_timestamp)) {
123 return true;
124 }
125
126 if (!is_string($maybe_timestamp) || !ctype_digit($maybe_timestamp)) {
127 return false;
128 }
129
130 try {
131 $datetime = DateTimeImmutable::createFromFormat(
'Ymd', $maybe_timestamp);
133 } catch (Throwable) {
134
135 }
136
137 return true;
138 }
References $datetime.
Referenced by assertFormatMatchesInput(), and autoDetectFormat().
The documentation for this class was generated from the following file: