Monday, November 26, 2012

How to Display MySQL Dates in different Formats using PHP

Formats
PHP Code
November 27, 2012
date("F d, Y",strtotime($row['date']));
Tuesday, November 27, 2012
date("l, F d, Y",strtotime($row['date']));
Nov 27, 2012
date("M d, Y",strtotime($row['date']));
27 November 2012
date("d M Y",strtotime($row['date']));
27 Nov 2012
date("d M Y",strtotime($row['date']));
Tue, 27 Nov 2012
date("D, d M Y",strtotime($row['date']));
Tuesday, the 27th of November, 2012
date("l",strtotime($row['date'])) . ", the " . date("jS",strtotime($row['date'])) . " of " . date("F, Y",strtotime($row['date']));    
March 4, 2021 10:04 AM                                                   date("F j, Y g:i A", strtotime($row['date']))

No comments:

Post a Comment

Please Comment Here!

How to backup and download Database using PHP

< ?php $mysqlUserName = 'databaseusername' ; $mysqlPassword = 'databasepassword' ; $mysqlHostNa...