I am trying to do a very simple thing but I am getting erratic results. I believe I am doing it exactly as defined in the php manual, but it is not working. In the php manual a user, James Meyer, commented that php 5.2 and 5.3+ have issues with this command. So what works?
All I want to do is leave the time off a datetime value when displayed on a webpage. I have tried every possible way I can imagine using both date() and date_format(), but I either get all the dates as 1969-12-31 or nothing at all. I use an SQL command to retrieve the values from the database and then this php to display them...
If I just useCode:<?php echo date_format($client['edited'], 'Y-m-d');?><?php echo $client['edited'];?>the date displays the correct date but with the time also, which wraps and messes up the display.
I just noticed this message in the error log... in the SQL command I use$client = mysql_fetch_assoc($result)and do not convert the value from the DateTime field...
Code:PHP Warning: date_format() expects parameter 1 to be DateTime, string given in /public_html/php/file-name.php on line 20



Reply With Quote



Bookmarks