![]() |
PHP Date Formatting ExamplesYou often need to display a date in a particular format, so here's an example of formatting a date and time in PHP to adhere to the American date formatting standard (month before day). In this example, we are lifting a date field from a MySQL database as follows: $list['ReviewDate'] To give this date a particular format when displayed on the page, we use: date('H:i:s, M d Y', strtotime($list['ReviewDate'])) which outputs the time and date with the month before the day, as follows: 14:42:24, Jun 04 2009 If we didn't want the time shown at all, we could just use: date('M d Y', strtotime($list['ReviewDate'])) which would output: Jun 04 2009 |
|
All Content ©2020 WebRef.eu |