ILIAS  release_8 Revision v8.24
Factory.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Data\DateFormat;
22
27{
29
31 {
32 $this->builder = $builder;
33 }
34
38 public function standard(): DateFormat
39 {
40 return $this->builder->year()->dash()->month()->dash()->day()->get();
41 }
42
46 public function custom(): FormatBuilder
47 {
48 return $this->builder;
49 }
50
52 {
53 return $this->builder->initWithFormat($format);
54 }
55
56 public function germanShort(): DateFormat
57 {
58 return $this->builder->day()->dot()->month()->dot()->year()->get();
59 }
60
61 public function germanLong(): DateFormat
62 {
63 return $this->builder->weekday()->comma()->space()
64 ->day()->dot()->month()->dot()->year()->get();
65 }
66
68 {
69 return $this->amend($format)
70 ->space()->hours12()->colon()->minutes()->space()->meridiem()->get();
71 }
72
74 {
75 return $this->amend($format)
76 ->space()->hours24()->colon()->minutes()->get();
77 }
78}
A Date Format provides a format definition akin to PHP's date formatting options, but stores the sing...
Definition: DateFormat.php:27
Factory for Date Formats.
Definition: Factory.php:27
standard()
Get the ISO 8601 date format (YYYY-MM-DD)
Definition: Factory.php:38
withTime24(DateFormat $format)
Definition: Factory.php:73
__construct(FormatBuilder $builder)
Definition: Factory.php:30
amend(DateFormat $format)
Definition: Factory.php:51
custom()
Get the builder to define a custom DateFormat.
Definition: Factory.php:46
withTime12(DateFormat $format)
Definition: Factory.php:67
Builds a Date Format with split up elements to ease conversion.
$format
Definition: metadata.php:235