ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
51 public function amend(DateFormat $format): FormatBuilder
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
67 public function americanShort(): DateFormat
68 {
69 return $this->builder->month()->slash()->day()->slash()->year()->get();
70 }
71
72 public function withTime12(DateFormat $format): DateFormat
73 {
74 return $this->amend($format)
75 ->space()->hours12()->colon()->minutes()->space()->meridiem()->get();
76 }
77
78 public function withTime24(DateFormat $format): DateFormat
79 {
80 return $this->amend($format)
81 ->space()->hours24()->colon()->minutes()->get();
82 }
83}
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:78
__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:72
Builds a Date Format with split up elements to ease conversion.