Issue
I have a table in mysql for people's posts. But I'd like to be able to get the time the post was made? How do I do it? Any help will be appreciated. The language I'm using is PHP and I'm using prepared statements. Is it as simple as specifying a column in the database with the datatype TIMESTAMP? And how do I read a timestamp and convert it to a date?
Solution
$timestamp = date("Y-m-d H:i:s");
check your table setup to confirm that the field is set to NOT NULL with a default of CURRENT_TIMESTAMP and above code will return you current date and time which will be in string format. Which you can push in to table.
Answered By - Who Do You think am i
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.