Pretty Dates from MySQL DateTime
So I'm working on a project where I want to show a formatted join date on a user profile page. The join date, of course, is stored in a MySQL database using the datetime column type. I know you can use the MySQL built in function DATE_FORMAT, but I wanted to be able to do this right in my PHP rather than in a query.
So here's an easy, one-line bit of code to give you a date in any format you choose using your datetime value from your database result:
PHP:
Is this helpful for you? Am I trying to roll a square wheel here and you know a better way? Comment and let me know!
Tags: php, mysql, datetime, pretty dates
This entry was posted on Friday, June 13th, 2008.
You can leave a comment, or trackback from your own site.
You can leave a comment, or trackback from your own site.
No Comments Yet
You can be the first to comment!

Leave a comment