how can I format this output "<td><? echo $rows['name']; ?></td>" from a mysql database to: MM-DD-YY Please help thank you
How you'd format the output depends on what's in the $rows['name'] variable. Can you give an example of what this says now? Besides, having a date in a database with a column name "name" is a bit... wonky.
If the column 'name' in the database is a timestamp, then you do this: <td><? echo date("m-d-Y", $rows['name']); ?></td> Code (markup): However if its a datetime, then you can do this: <td><? echo date("m-d-Y", strtotime($rows['name'])); ?></td> Code (markup):
Yes, that is the first thing I did before I came here looking for help. I got lost trying to figure out out how to get it done. I agree with you, but to explain exactly why It's named "name" is a very long story Thank you for your help Thank you so much for your help. I will try to see if that will work.
We can try to use PHP explode() to create an array with your month, date and year or we can use a timestamp to generate a date with the date() function. It depends on the output. Please tell us what the output is when you view your code in your browser. Kind regards, Maarten