I am making my own forum. I have only limited knowledge of dates and times. When someone makes a post I want to detect the time of the post and the date or maybe even the date time.
How would I write this in PHP. If I store this in a date and time within a database are there any problems with that
If you are using a database just have a field in the posts table that is a timestamp type. Then when you pull that back out to display use date and strtotime to format is the way you want, like:
date(‘format here’, strtotime($row[‘field_name’]));
http://us.php.net/manual/en/function.date.php
I suppose DB column is of type datetime
then you can simply code this way:
INSERT INTO table_name SET
post_date = now()