|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
I am trying to convert a mySQL datetime to a readable format. The default for datetime is 0000-00-00 00:00:00. When I use the code below, I get the correct date and day, just not the correct time.
Saturday, 04.03.04 @ 00:00am. PHP Code:
any help appreciated |
|
#2
|
||||
|
||||
|
There's a few different solutions... first of all, you could format the actual return result using the SQL statement...
SELECT DATE_FORMAT(date_field, '%W, %y.%m.%e @ %h:%i %p') FROM table Refer to this: http://www.mysql.com/doc/en/Date_an..._functions.html Or you could try the PHP date functions: http://ca3.php.net/manual/en/function.date.php |
|
#3
|
|||
|
|||
|
From the php manual:
[PHP]*** mktime ( [int hour, int minute , int second , int month , int day , int year ) [PHP] So you're passing 0 for the hour, minute and seconds in your code so the time you're displaying is correct. HTH |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > MySQL datetime w/php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|