Greetings, I have a Private Message tool and I would like to store a "timestamp" in the MySQL database of when each message was sent. When someone receives the message, I would like it to display in the same format as the Digital Point forum: such as: (Jun 25th 2010 12:24 pm) and (Today 2:45 pm) Question 1: How would I set up a column in MySQL to store this? (DATETIME, TIMESTAMP)? Question 2: How would I store the date in CENTRAL TIME ZONE? (on update automatic timestamp, now(), date(), etc) ? Question 3: How would I display this date like it does at DP forum? I read about dates being incorrect or having to be stored in Unix time, Epoch or problems with local host time and everything seems way to confusing. I'm hoping someone knows the proper and standard way to do it. Thanks
If you have access to phpMyAdmin, there is an option to add a new row to a table. Just add a new row called "time" and change the type to your choosing. Storing it in the Central Time Zone (CST) is actually pretty easy. The code would look like this: <?php date_default_timezone_set("US/Central"); //Change this to your desired time zone - http://www.php.net/manual/en/function.date-default-timezone-set.php echo date("M jS Y g:ia"); ?> PHP: <?php echo date("M jS Y g:ia"); // http://us.php.net/manual/en/function.date.php for more info ?> PHP: PM me if you need any help.