|
4 | 4 | * Format class |
5 | 5 | * Help convert between various formats such as XML, JSON, CSV, etc. |
6 | 6 | * |
7 | | - * @author Phil Sturgeon, Chris Kacerguis, @softwarespot |
| 7 | + * @author Phil Sturgeon, Chris Kacerguis, Kwame Oteng Appiah-Nti, @softwarespot |
8 | 8 | * @license http://www.dbad-license.org/ |
9 | 9 | */ |
10 | 10 |
|
@@ -127,6 +127,46 @@ public static function factory($data, $from_type = null) |
127 | 127 | return new static($data, $from_type); |
128 | 128 | } |
129 | 129 |
|
| 130 | + // FORMATTING DATE & TIME --------------------------------------------------------- |
| 131 | + |
| 132 | + /** |
| 133 | + * Take date and set a custom date format |
| 134 | + * |
| 135 | + * @param string $format |
| 136 | + * @param string $date |
| 137 | + * @return string |
| 138 | + */ |
| 139 | + public function date($format, $date) |
| 140 | + { |
| 141 | + return format_date($format, $date); |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * Take date and format it in Y-m-d |
| 146 | + * This fixes a date and can be stored |
| 147 | + * and used easily |
| 148 | + * |
| 149 | + * @param string $date |
| 150 | + * @return string |
| 151 | + */ |
| 152 | + public function fixDate($date) |
| 153 | + { |
| 154 | + return correct_date($date); |
| 155 | + } |
| 156 | + |
| 157 | + /** |
| 158 | + * Take datetime and format it in Y-m-d H:i:a |
| 159 | + * This fixes a datetime and can be stored |
| 160 | + * and used easily |
| 161 | + * |
| 162 | + * @param string $datetime |
| 163 | + * @return string |
| 164 | + */ |
| 165 | + public function fixDatetime($datetime) |
| 166 | + { |
| 167 | + return correct_datetime($datetime); |
| 168 | + } |
| 169 | + |
130 | 170 | // FORMATTING OUTPUT --------------------------------------------------------- |
131 | 171 |
|
132 | 172 | /** |
|
0 commit comments