1: | <?php declare(strict_types=1); |
2: | |
3: | namespace Salient\Contract\Core; |
4: | |
5: | use DateTimeImmutable; |
6: | use DateTimeInterface; |
7: | |
8: | /** |
9: | * @api |
10: | */ |
11: | interface DateFormatterInterface |
12: | { |
13: | /** |
14: | * Format a date and time |
15: | */ |
16: | public function format(DateTimeInterface $date): string; |
17: | |
18: | /** |
19: | * Convert a value to a date and time, or return null if it can't be parsed |
20: | */ |
21: | public function parse(string $value): ?DateTimeImmutable; |
22: | } |
23: |