| @@ 78-91 (lines=14) @@ | ||
| 75 | * @param string $format The format to use. |
|
| 76 | * @return string |
|
| 77 | */ |
|
| 78 | public function formatDate($date, $format = 'default') |
|
| 79 | { |
|
| 80 | $this->dateFormat = $format; |
|
| 81 | ||
| 82 | if (is_array($date)) { |
|
| 83 | $this->from = $this->parseAsDate($date[0]); |
|
| 84 | $this->to = $this->parseAsDate($date[1]); |
|
| 85 | } else { |
|
| 86 | $this->from = $this->parseAsDate($date); |
|
| 87 | $this->to = null; |
|
| 88 | } |
|
| 89 | ||
| 90 | return $this->formatDateFromCase($this->getDateCase()); |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * @param mixed $date The date |
|
| @@ 101-114 (lines=14) @@ | ||
| 98 | * @param string $format The format to use. |
|
| 99 | * @return string |
|
| 100 | */ |
|
| 101 | public function formatTime($date, $format = 'default') |
|
| 102 | { |
|
| 103 | $this->timeFormat = $format; |
|
| 104 | ||
| 105 | if (is_array($date)) { |
|
| 106 | $this->from = $this->parseAsDate($date[0]); |
|
| 107 | $this->to = $this->parseAsDate($date[1]); |
|
| 108 | } else { |
|
| 109 | $this->from = $this->parseAsDate($date); |
|
| 110 | $this->to = null; |
|
| 111 | } |
|
| 112 | ||
| 113 | return $this->formatTimeFromCase($this->getTimeCase()); |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Get the usage case by comparing two dates. |
|