| 1 | <?php |
||
| 23 | class DateTimeRenderer { |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Date/time format. |
||
| 27 | * |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | const DATETIME_FORMAT = "Y-m-d H:i"; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Render an age. |
||
| 34 | * |
||
| 35 | * @param DateTime $birthDate The birth date. |
||
| 36 | * @param DateTime|null $refDate The reference date. |
||
| 37 | * @return int Returns the age. |
||
| 38 | * @throws Exception Throws an exception if an errors occurs. |
||
| 39 | */ |
||
| 40 | public static function renderAge(DateTime $birthDate, DateTime $refDate = null) { |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Render a date/time. |
||
| 55 | * |
||
| 56 | * @param DateTime|null $dateTime The date/time. |
||
| 57 | * @param string $format The format. |
||
| 58 | * @return string Returns the rendered date/time. |
||
| 59 | */ |
||
| 60 | public static function renderDateTime(DateTime $dateTime = null, $format = self::DATETIME_FORMAT) { |
||
| 66 | } |
||
| 67 |