OK, so I was looking around the Internet trying to find out how to format the date that has been pulled from a mysql database and did not get very far, so I thought I would write this blog post. I have been using Prepared Statements and PDO for a few years now as mysqli can be subject to mysql injection. I was pulling a ‘timestamp’ data type from a mysql database which contains the date and time that the record was created.Lets go through the code step by step.
A Prepared Statement gets the data
Next we need to use the data in a table
So what does it look like when you finished?
Below is a screenshot of my little application. The date can be manipulated to remove the year or to display the time if you wish.