WebRef.eu  - Internet Marketing and Online Business Resources  

Home / Site Map | Contact

 

PHP Date Formatting Examples

You 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




Low Prices UK Shopping

Compare Prices
at LowPrices.co.uk


Home / Site Map | Contact

All Content ©2020 WebRef.eu