Dates in PHP-MYSQL
Moderator: General Moderators
Dates in PHP-MYSQL
how do you change the date from MYSQL's YYYY-MM-DD to lets say March 3 or so? 
Check out http://www.mysql.com/doc/D/a/Date_and_t ... tions.html. Scroll down until you reach the DATE_FORMAT() function.
if you don't understand that then:
that should get you date in 28/05/02 format.
Code: Select all
$date1 = date("j/m/Y");http://www.php.net/manual/en/function.date.php
Or just go look there and create something nice in whatever format you want.
Or just go look there and create something nice in whatever format you want.
- groovemaneuver
- Forum Newbie
- Posts: 2
- Joined: Thu May 16, 2002 3:08 am
- Location: Honolulu, HI
I would definitely recommend going with the MySQL date formatting over the PHP formatting. This is not to say anything against PHP's really cool date formatting functions, but rather as a means of increasing your script's performance.Ruiser wrote:Check out http://www.mysql.com/doc/D/a/Date_and_t ... tions.html. Scroll down until you reach the DATE_FORMAT() function.
Database engines are programmed to be as fast as possible (it's part of their marketability if they do well on benchmarks). Using a formatted result in a MySQL query will almost always be faster than a result that needs formatting applied to it.
Take some of the load off your PHP engine and take advantage of external speed where it's available
Cheers!