ILIAS
release_6 Revision v6.24-5-g0c8bfefb3b8
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
s
t
w
+
Functions
_
a
b
c
f
g
h
i
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
DateFormat.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (c) 2019 Nils Haagen <nils.haagen@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
4
namespace
ILIAS\Data\DateFormat
;
5
10
class
DateFormat
11
{
12
const
DOT
=
'.'
;
13
const
COMMA
=
','
;
14
const
DASH
=
'-'
;
15
const
SLASH
=
'/'
;
16
const
SPACE
=
' '
;
17
const
DAY
=
'd'
;
18
const
DAY_ORDINAL
=
'jS'
;
19
const
WEEKDAY
=
'l'
;
20
const
WEEKDAY_SHORT
=
'D'
;
21
const
WEEK
=
'W'
;
22
const
MONTH
=
'm'
;
23
const
MONTH_SPELLED
=
'F'
;
24
const
MONTH_SPELLED_SHORT
=
'M'
;
25
const
YEAR
=
'Y'
;
26
const
YEAR_TWO_DIG
=
'y'
;
27
28
const
TOKENS
= [
29
self::DOT,
30
self::COMMA,
31
self::DASH,
32
self::SLASH,
33
self::SPACE,
34
self::DAY,
35
self::DAY_ORDINAL,
36
self::WEEKDAY,
37
self::WEEKDAY_SHORT,
38
self::WEEK,
39
self::MONTH,
40
self::MONTH_SPELLED,
41
self::MONTH_SPELLED_SHORT,
42
self::YEAR,
43
self::YEAR_TWO_DIG
44
];
45
49
protected
$format
= [];
50
51
public
function
__construct
(array
$format
)
52
{
53
$this->
validateFormatElelements
($format);
54
$this->format =
$format
;
55
}
56
57
public
function
validateFormatElelements
(array
$format
)
58
{
59
foreach
($format as $entry) {
60
if
(!in_array($entry, self::TOKENS)) {
61
throw
new \InvalidArgumentException(
"not a valid token for date-format"
, 1);
62
}
63
}
64
}
65
70
public
function
toArray
() : array
71
{
72
return
$this->format
;
73
}
74
79
public
function
toString
() : string
80
{
81
return
implode(
''
, $this->format);
82
}
83
}
ILIAS\Data\DateFormat\DateFormat\MONTH_SPELLED
const MONTH_SPELLED
Definition:
DateFormat.php:23
ILIAS\Data\DateFormat\DateFormat\COMMA
const COMMA
Definition:
DateFormat.php:13
ILIAS\Data\DateFormat\DateFormat\YEAR
const YEAR
Definition:
DateFormat.php:25
ILIAS\Data\DateFormat\DateFormat\toArray
toArray()
Get the elements of the format as array.
Definition:
DateFormat.php:70
ILIAS\Data\DateFormat\DateFormat\validateFormatElelements
validateFormatElelements(array $format)
Definition:
DateFormat.php:57
ILIAS\Data\DateFormat\DateFormat\TOKENS
const TOKENS
Definition:
DateFormat.php:28
ILIAS\Data\DateFormat\DateFormat\DOT
const DOT
Definition:
DateFormat.php:12
ILIAS\Data\DateFormat\DateFormat\YEAR_TWO_DIG
const YEAR_TWO_DIG
Definition:
DateFormat.php:26
ILIAS\Data\DateFormat\DateFormat\DASH
const DASH
Definition:
DateFormat.php:14
ILIAS\Data\DateFormat\DateFormat\MONTH
const MONTH
Definition:
DateFormat.php:22
ILIAS\Data\DateFormat\DateFormat\SPACE
const SPACE
Definition:
DateFormat.php:16
ILIAS\Data\DateFormat\DateFormat\SLASH
const SLASH
Definition:
DateFormat.php:15
ILIAS\Data\DateFormat\DateFormat\DAY
const DAY
Definition:
DateFormat.php:17
ILIAS\Data\DateFormat
Definition:
DateFormat.php:4
ILIAS\Data\DateFormat\DateFormat\toString
toString()
Get the format as string.
Definition:
DateFormat.php:79
ILIAS\Data\DateFormat\DateFormat\DAY_ORDINAL
const DAY_ORDINAL
Definition:
DateFormat.php:18
ILIAS\Data\DateFormat\DateFormat\$format
$format
Definition:
DateFormat.php:49
ILIAS\Data\DateFormat\DateFormat\MONTH_SPELLED_SHORT
const MONTH_SPELLED_SHORT
Definition:
DateFormat.php:24
ILIAS\Data\DateFormat\DateFormat\__construct
__construct(array $format)
Definition:
DateFormat.php:51
ILIAS\Data\DateFormat\DateFormat\WEEKDAY
const WEEKDAY
Definition:
DateFormat.php:19
ILIAS\Data\DateFormat\DateFormat\WEEK
const WEEK
Definition:
DateFormat.php:21
ILIAS\Data\DateFormat\DateFormat\WEEKDAY_SHORT
const WEEKDAY_SHORT
Definition:
DateFormat.php:20
src
Data
DateFormat
DateFormat.php
Generated on Mon Apr 7 2025 20:01:33 for ILIAS by
1.8.13 (using
Doxyfile
)