1 | <?php |
||
12 | class DateTime |
||
13 | { |
||
14 | /** |
||
15 | * Filters the given value into a \DateTime object. |
||
16 | * |
||
17 | * @param mixed $value The value to be filtered. |
||
18 | * @param boolean $allowNull True to allow nulls through, and false (default) if nulls should |
||
19 | * not be allowed. |
||
20 | * @param DateTimeZoneStandard $timezone A \DateTimeZone object representing the timezone of $value. |
||
21 | * If $timezone is omitted, the current timezone will be used. |
||
22 | * |
||
23 | * @return DateTimeStandard|null |
||
24 | * |
||
25 | * @throws Exception if the value did not pass validation. |
||
26 | */ |
||
27 | public static function filter($value, bool $allowNull = false, DateTimeZoneStandard $timezone = null) |
||
47 | |||
48 | /** |
||
49 | * Filters the give \DateTime object to a formatted string. |
||
50 | * |
||
51 | * @param DateTimeInterface $dateTime The date to be formatted. |
||
52 | * @param string $format The format of the outputted date string. |
||
53 | * |
||
54 | * @return string |
||
55 | * |
||
56 | * @throws \InvalidArgumentException Thrown if $format is not a string |
||
57 | */ |
||
58 | public static function format(DateTimeInterface $dateTime, string $format = 'c') : string |
||
66 | } |
||
67 |